Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to figure out how many permutations exist in a set where none of the numbers equal their own position in the set; for example, $3,1,5,2,4$ is an acceptable permutation where $3,1,2,4,5$ is not because 5 is in position 5. I know that the number of total permutations is $n!$.
Is there a formula for how many are acceptable given the case that no position holds its own number?

share|cite|improve this question
Check out – Florian Dec 17 '10 at 13:13
Florian, your comment should be an answer. – Anthony Labarre Dec 17 '10 at 13:15
This recent math.SE question asks for a proof of one of the formulas for the number of derangements: – Mike Spivey Dec 17 '10 at 15:52

What you are looking for is known as derangement. However, for counting the number of derangement for say $n$-elements you could possible use a trick, compute$\frac{n!}{e}$ and then round off to an integer and this will give you the desired result.

This is actually another application of $e$, which was discovered by Jacob Bernoulli in the problem of derangement, also known as the hat check problem.

share|cite|improve this answer

Check out

share|cite|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Gamma Function Aug 5 '14 at 23:27
Please add more content from the cited page (e.g. describe derangements, etc). Otherwise, this should really be left as a comment. – robjohn Aug 7 '14 at 0:07

In his combinatorics lecture notes, Jacob Lurie analyses the problem of derangements. It is at the end of these note:

and continues into these

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.