Skip to main content

Counting Derangements

Counting derangements means counting permutations where no item stays in its original position. In Combinatorics, this is written as !n and shows up in restricted arrangement problems.

Last updated July 2026

What is Counting Derangements?

Counting derangements is the Combinatorics problem of counting permutations with no fixed points, meaning nothing ends up in the spot it started in. If you line up n objects and then rearrange them, a derangement is one arrangement where every object has moved.

The notation for the number of derangements of n objects is !n, read as "subfactorial" or sometimes "derangements of n." For example, if you have 4 hats and 4 people, a derangement is a way to hand the hats back so that nobody gets their own hat. This is a restricted permutation, not a brand new counting idea separate from permutations.

The cleanest way to count derangements is with inclusion-exclusion. Start with all n! permutations, then subtract the arrangements where at least one object stays put. That first subtraction overcounts, so you add back arrangements with two fixed points, then subtract those with three fixed points, and so on. The pattern gives the formula !n = n!(1 - 1/1! + 1/2! - 1/3! + ... + (-1)^n/n!).

You can also use the recurrence !n = (n - 1)(!(n - 1) + !(n - 2)). That recurrence is useful when a problem asks for values step by step instead of a closed form. The logic behind it comes from choosing where one object goes, then tracking what happens to the object that lands in its original place.

Small values are worth memorizing because they show the pattern. !1 = 0, !2 = 1, !3 = 2, and !4 = 9. The fact that !n is always less than n! makes sense, because you are counting only the permutations that satisfy a strict restriction.

A common mistake is to confuse derangements with "all permutations except the identity." That would only remove one arrangement, but derangements remove every permutation that leaves even one object fixed. Another easy slip is to think "nobody gets their own item" means the answer is just n! minus n, which misses overlaps between fixed-point cases. Inclusion-exclusion is exactly what fixes that problem.

Why Counting Derangements matters in COMBINATORICS

Counting derangements is one of the best places to see why Combinatorics needs more than ordinary multiplication. The moment a problem adds a restriction like "no one gets their own item," simple permutation counting overcounts badly. Derangements show you how to correct that count with inclusion-exclusion or a recurrence.

This term also connects a lot of the counting tools in the course. You see permutations, factorials, complements, and overlapping conditions all in one problem. If you can count derangements, you are practicing the exact skill of translating a word restriction into a counting setup, which is one of the core moves in combinatorics.

Derangements also give a famous approximation result: for large n, the fraction of permutations that are derangements approaches 1/e. That means the answer is not just a one-off puzzle. It links finite counting to probability ideas and shows how a pattern in exact counting can settle into a stable ratio.

In class problems, derangements often appear in matching situations, seat assignments, secret Santa style pairings, or any setup where original placement is forbidden. The term gives you a shortcut for recognizing that the right tool is not brute force, but a structured counting method with fixed points removed.

Keep studying COMBINATORICS Unit 5

How Counting Derangements connects across the course

Permutation

A derangement is a special kind of permutation. Every derangement is a rearrangement of the original set, but not every permutation qualifies because fixed points are not allowed. When a problem says to count arrangements, first check whether the restriction turns it into a derangement question instead of a plain permutation count.

Factorial

Factorials give the starting point for derangements because n! counts all permutations before any restriction is applied. From there, you adjust for forbidden fixed points. If you do not know what n! represents, the derangement formulas feel abstract, but once you see n! as the total pool, the inclusion-exclusion setup makes sense.

Inclusion-Exclusion Principle

This is the main counting method behind the closed-form derangement formula. You count all permutations, subtract those with at least one fixed point, then correct for overlaps where two or more objects are fixed. Derangements are a classic example of why inclusion-exclusion exists in the first place.

Complement of a Set

Derangements are often easier to count by starting with the complement of the "bad" cases. The bad cases are permutations with at least one fixed point, and inclusion-exclusion helps count that complement accurately. Thinking this way trains you to use negative conditions in counting problems instead of listing every allowed arrangement directly.

Is Counting Derangements on the COMBINATORICS exam?

A problem set or quiz item on counting derangements usually gives a restricted arrangement scenario and asks for the number of valid permutations. You identify the fixed points that are forbidden, decide whether inclusion-exclusion or the recurrence is the better path, and then compute !n or a related count. If the question asks for an explanation, you should say why simple permutation counting fails and show how the restriction changes the setup.

A common format is a matching or seating problem, like assigning letters, hats, or gifts so nobody gets the original item. If the numbers are small, you may list cases or use the recurrence. If the numbers are larger, the inclusion-exclusion formula is faster and cleaner. You can also be asked for the probability of a derangement, which means dividing !n by n! and interpreting the result.

Counting Derangements vs Permutation

Permutation counts every possible rearrangement, including ones where some items stay in place. Derangement is stricter because no item can remain in its original position. If a question says "arrange" with no extra rule, use permutations; if it says "no one gets their own," you are in derangement territory.

Key things to remember about Counting Derangements

  • A counting derangement is a permutation with no fixed points, so every object moves to a different position.

  • !n is the standard notation for the number of derangements of n objects.

  • The best exact formula comes from inclusion-exclusion, which corrects for overlaps among fixed-point cases.

  • The recurrence !n = (n - 1)(!(n - 1) + !(n - 2)) is useful when you want to build answers from smaller values.

  • Derangements often show up in matching, seating, and assignment problems where original positions are forbidden.

Frequently asked questions about Counting Derangements

What is counting derangements in Combinatorics?

Counting derangements means counting the permutations of a set where no object stays in its original position. The answer is written as !n. In Combinatorics, this is a classic restricted permutation problem and a common application of inclusion-exclusion.

How do you count derangements?

The standard method is inclusion-exclusion: start with n! total permutations and subtract the arrangements with fixed points, then correct for overlaps. For a recursive approach, use !n = (n - 1)(!(n - 1) + !(n - 2)). For small n, either method works, but inclusion-exclusion gives the general formula.

What is the difference between a permutation and a derangement?

A permutation is any rearrangement of the objects. A derangement is a permutation with the extra rule that no object may remain in its original spot. So every derangement is a permutation, but many permutations are not derangements.

Why do derangements use inclusion-exclusion?

Because the forbidden cases overlap. If one object is fixed and another object is fixed, those arrangements get counted in both categories, so simple subtraction is not enough. Inclusion-exclusion fixes that overlap and gives the exact count.