Derangements CalculatorFree online math calculator — instant results, no sign-up
Count permutations in which no object remains in its original position.
Sign in to save results and favorites.
About the Derangements Calculator
The Derangements Calculator counts permutations of distinct objects in which no object stays in its original position. For the default input of 8 objects, it returns 14833 derangements, excluding every arrangement that leaves even one object in place.
- Number of objects
- The number of distinct objects to rearrange among their original positions, entered as a nonnegative whole-number count with no physical units.
Formula and method
D(n) = n! × Σ_{k=0}^{n} ((−1)^k / k!); D(8) = 8! × (1/0! − 1/1! + 1/2! − 1/3! + 1/4! − 1/5! + 1/6! − 1/7! + 1/8!) = 14833.- nThe number of distinct objects.
- D(n)The number of derangements of n objects, also written !n.
- kThe summation index, ranging from 0 through n.
- !When written after a number, the factorial operator: the product of positive integers up to that number, with 0! = 1.
- ΣThe instruction to add the expression for every integer index in the stated range.
The calculation uses inclusion–exclusion: start with all n! permutations, subtract those fixing at least one specified object, and alternate additions and subtractions to correct for overlapping fixed-position conditions. Evaluating the finite sum exactly for n = 8 gives D(8) = 14833. An equivalent integer recurrence is D(n) = (n − 1) × [D(n − 1) + D(n − 2)] for n ≥ 2, starting from D(0) = 1 and D(1) = 0.
Worked example
These are the calculator's starting values and the results it actually produces for them.
Inputs
- Number of objects8
Results
- Derangements14833
How to use the Derangements Calculator
- 1Identify the distinct objects and the original position assigned to each one.
- 2Enter a nonnegative whole number in Number of objects; keep the default value of 8 to reproduce the worked example.
- 3Run the calculation to count arrangements that move every object away from its original position.
- 4Read the Derangements result: with 8 objects, the output is 14833.
Reading your result
The Derangements output row is a count of valid complete arrangements, not a probability or percentage. The default result, Derangements = 14833, means there are exactly 14833 ways to assign the 8 distinct objects to the 8 positions while leaving none in its original position.
Limitations
The count assumes all objects and positions are distinguishable, every object occupies exactly one position, and the only forbidden assignment is an object's original position. It does not handle identical objects or additional placement restrictions. Negative and fractional inputs are not meaningful. Counts grow rapidly, so large inputs require exact-integer arithmetic; the maximum supported input depends on the implementation.
Common questions
Why does the default input of 8 produce 14833 rather than 8!?+
The value 8! counts every permutation, including those with objects still in their original positions. Inclusion–exclusion removes all such arrangements and leaves exactly 14833 derangements.
Does a derangement require all objects to form one cycle?+
No. A derangement can contain multiple separate cycles, provided none has length one. Objects may exchange positions in separate groups as long as no object remains fixed.
What happens with zero objects or a single object?+
By convention, D(0) = 1 because the empty arrangement has no fixed objects. D(1) = 0 because a single object has no other position to occupy.
Can I turn the derangements count into a probability?+
Yes, if every permutation is equally likely: divide D(n) by n!. For the default input, the probability that no object stays in place is 14833/8!, approximately 36.79%.
Does the calculator save my information?+
Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.
You might also like
Scientific Calculator
Full scientific calculator with trig, logs, powers, memory and degree/radian modes.
Fraction Calculator
Add, subtract, multiply and divide fractions.
Percentage Calculator
Percent of a number, what percent, and percent change.
Random Number Generator
Generate random integers in a range.
Percent Error Calculator
Error between an observed and true value.
Exponent Calculator
Raise a base to any power.
Results are estimates for informational purposes and are not financial, medical or legal advice.