Derangement Calculator

Enter the number of items to find how many derangements exist.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

A derangement is a permutation in which no element ends up in its original position — the classic illustration is the “hat-check problem,” where n people check their hats and every single one is handed back the wrong one. The count of derangements, written !n, follows the formula !n = n! × Σ(−1)^k/k! for k = 0 to n, and also satisfies the tidy recurrence !n = (n−1)(!(n−1) + !(n−2)).

This calculator computes !n for any number of items and the probability that a random permutation happens to be a derangement — a value that converges quickly to 1/e ≈ 36.8% as n grows. It’s a staple example in combinatorics and discrete math courses, and the underlying reasoning shows up in algorithm design and cryptography problems involving permutations with no fixed points, as well as in the well-known “Secret Santa” gift-exchange puzzle.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators