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.
Risultati
Inserisci i valori e clicca Calcola per vedere il risultato.
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
Probability
The probability that a random permutation is a derangement approaches 1/e ≈ 36.8% as n increases.
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].