Derangements Calculator

Calculate the number of derangements (permutations with no fixed points) and analyze the subfactorial function.

Enter a number between 0 and 20 to calculate derangements. Derangements are permutations where no element appears in its original position.

Ergebnisse

Geben Sie Werte ein und klicken Sie auf Berechnen, um das Ergebnis zu sehen.

Theory & Formula

Derangements Theory

A derangement is a permutation where no element appears in its original position. The number of derangements of n elements is denoted !n (subfactorial of n).

Key Formulas

Series Formula: \(!n = n! \sum_{k=0}^{n} \frac{(-1)^k}{k!}\)
Recursive Formula: \(!n = (n-1)(!(n-1) + !(n-2))\)
Approximation: \(!n \approx \frac{n!}{e}\) for large n

Probability

The probability that a random permutation is a derangement approaches 1/e ≈ 36.8% as n increases.

\(\lim_{n \to \infty} \frac{!n}{n!} = \frac{1}{e} \approx 0.367879\)

Applications

The hat-check problem: n people check their hats, and the hats are returned randomly. What is the probability that no one gets their own hat back? Answer: !n/n! ≈ 1/e.

Example

For n=3: !3 = 2. The permutations [2,3,1] and [3,1,2] are the only derangements of [1,2,3].

Derangements Calculator | Subfactorial & Hat-Check Problem | MathCalcLab | MathCalcLab