Skip to main content
Calkulon
Back to Guides
3 min read6 Steps

How to Calculate Derangements: Step-by-Step Guide

Calculate derangements manually

Skip the math — use the calculator

Step-by-Step Instructions

1

Understand the Subfactorial Formula

The subfactorial formula to calculate derangements is D(n) = n! * (1/0! - 1/1! + 1/2! - 1/3! + ... + ((-1)^n)/n!). Understand that n! denotes the factorial of n, which is the product of all positive integers up to n.

2

Calculate the Factorial of n

Calculate the factorial of n, denoted as n!. For example, if n = 4, then 4! = 4 * 3 * 2 * 1 = 24.

3

Apply the Subfactorial Formula

Plug in the values into the subfactorial formula. Using the example from step 2, calculate D(4) = 4! * (1/0! - 1/1! + 1/2! - 1/3! + 1/4!). Calculate each term separately: 1/0! = 1, 1/1! = 1, 1/2! = 1/2, 1/3! = 1/6, and 1/4! = 1/24.

4

Simplify the Expression

Simplify the expression by calculating the sum inside the parentheses: (1/0! - 1/1! + 1/2! - 1/3! + 1/4!) = (1 - 1 + 1/2 - 1/6 + 1/24) = (1/2 - 1/6 + 1/24). Calculate the common denominator and simplify: (12/24 - 4/24 + 1/24) = 9/24 = 3/8.

5

Calculate the Final Result

Now, multiply the result from step 2 by the result from step 4: D(4) = 4! * (3/8) = 24 * (3/8) = 9.

6

Common Mistakes to Avoid

Common mistakes to avoid when calculating derangements include incorrect calculation of the factorial, incorrect application of the subfactorial formula, and not simplifying the expression correctly. Always double-check your calculations to ensure accuracy.

Introduction to Derangements

Derangements are permutations of objects where no object is in its original position. The number of derangements of n objects, denoted as D(n), can be calculated using the subfactorial formula. In this guide, we will walk you through the steps to calculate derangements manually.

What are Derangements?

Before we dive into the calculation, let's understand what derangements are. A derangement is a permutation of objects where no object is in its original position. For example, if we have three objects - A, B, and C - the derangements of these objects are:

  • A to C, B to A, C to B
  • A to B, B to C, C to A

Subfactorial Formula

The subfactorial formula to calculate derangements is: D(n) = n! * (1/0! - 1/1! + 1/2! - 1/3! + ... + ((-1)^n)/n!) where n! denotes the factorial of n.

Step-by-Step Guide

Ready to Calculate?

Skip the manual work and get instant results.

Open Calculator

Settings

PrivacyTermsAbout© 2026 Calkulon