How to find all the derangements of [n]. Specifically,if n is 4?
What is the process to get all the derangments in general?
How to find all the derangements of [n]. Specifically,if n is 4?
What is the process to get all the derangments in general?
A braindead method would be to list all the permutations of $[n]$ and then remove the ones with fixed points. You can list all the permutations of $[n]$ by listing them in lexicographic order, for example.
Another method is as follows. The elements of $S_n$ with no fixed points are precisely those permutations which contain no $1$-cycles when written as a product of disjoint cycles. For $n=4$ these permutations must have cycle type $(2,2)$ or $(4)$, i.e. they look like $(\,\cdot\ \cdot\,)(\,\cdot\ \cdot\,)$ or $(\,{\cdot}\ {\cdot}\ {\cdot}\ {\cdot}\,)$. They're easy enough to find; then apply each of these to your set.
A general method is described in Gray code for derangements by Jean-Luc Baril and Vincent Vajnovszki, Discrete Applied Mathematics $140$ ($2004$) $207$–$221$.