Derangement Number Calculator
Derangement Number Calculator
A derangement is a special kind of permutation where absolutely no item ends up back in its original position — the classic illustration is the hat-check problem, where a derangement is any outcome in which nobody gets their own hat back. Enter the number of items, and this calculator finds exactly how many derangements are possible using a well-known recurrence relation. Perhaps surprisingly, roughly 37% of all permutations turn out to be derangements as the number of items grows, a ratio that converges quickly.
- A derangement is a permutation where absolutely no element lands in its original position, unlike ordinary permutations, which allow any arrangement including ones where some items don't move.
- The classic example is a hat-check problem: if n people each check a hat and the hats are returned randomly, a derangement is any outcome where nobody gets their own hat back.
- Derangements are surprisingly common: for large n, roughly 1/e (about 37%) of all permutations are derangements, a ratio that converges quickly as n grows.
How is a derangement calculated?
Using the recurrence !n = (n−1)(!(n−1) + !(n−2)), starting from !0 = 1 and !1 = 0.
How many derangements does a set of 4 items have?
9 — there are 9 ways to rearrange 4 items so that none stays in its original position.
Derangement Number Calculator


A derangement is a special kind of permutation where absolutely no item ends up back in its original position — the classic illustration is the hat-check problem, where a derangement is any outcome in which nobody gets their own hat back. Enter the number of items, and this calculator finds exactly how many derangements are possible using a well-known recurrence relation. Perhaps surprisingly, roughly 37% of all permutations turn out to be derangements as the number of items grows, a ratio that converges quickly.

- A derangement is a permutation where absolutely no element lands in its original position, unlike ordinary permutations, which allow any arrangement including ones where some items don't move.
- The classic example is a hat-check problem: if n people each check a hat and the hats are returned randomly, a derangement is any outcome where nobody gets their own hat back.
- Derangements are surprisingly common: for large n, roughly 1/e (about 37%) of all permutations are derangements, a ratio that converges quickly as n grows.
How is a derangement calculated?
Using the recurrence !n = (n−1)(!(n−1) + !(n−2)), starting from !0 = 1 and !1 = 0.
How many derangements does a set of 4 items have?
9 — there are 9 ways to rearrange 4 items so that none stays in its original position.
