# Is there a way to get all the permutations of $S_4$

I need to calculate the determinant of a $4 \times 4$ matrix by "direct computation", so I thought that means using the formula

$$\sum_{\sigma \in S_4} (-1)^{\sigma}a_{1\sigma(1)}\ldots a_{n\sigma(n)}$$

So first I wanted to write down all the permutations of $S_4$ but I've only got 23 out of the 24 and I can't think of the last one. I was wondering if there is a "method" I can use to get all of them (apart from Googling them) and make sure that they are all unique and I've not done the same one twice?

Right now, I have

$$\begin{matrix} () & (34) & (143) & (1243) \\ (12) & (123) & (234) & (3241)\\ (13) & (132) & (243) & (1324) \\ (14) & (124) & (324) & (4231) \\ (23) & (142) & (1234) & (4321) \\ (24) & (134) & (2134) \\ \end{matrix}$$

What one am I missing?

-
Expanding the determinant along a row is a direct computation. – Chris Godsil Feb 2 '13 at 16:12
By the way, you have repetitions in your list, $(3241)$ is same as $(1324)$. Missing $(12)(34)$ and its relatives. – André Nicolas Feb 2 '13 at 16:17
Note that $\,(243)=(324)\,$ and you're missing the three involutions of the form $\,(ab)(cd)\,$ ,with all $\,a,b,c,d,\,$ different. – DonAntonio Feb 2 '13 at 16:18
You could avoid repetition if you always write cycles beginning with the smallest integer, for example $\,(324)=(243)\,$... – DonAntonio Feb 2 '13 at 16:19

## 3 Answers

I don't think the cycle structure is particularly helpful for enumerating all permutations. There it is easier to think of a permutation as simply the numbers form 1 to 4 arranged in some order.

All such sequences can be generated systematically by taking first those that have 1, then those that have 2 in the first place, and so on. Within each group, do a similar split on the second place, and proceed recursively. You get:

1,2,3,4
1,2,4,3
1,3,2,4
1,3,4,2
1,4,2,3
1,4,3,2
2,1,3,4
...
2,4,3,1
3,1,2,4
...
4,3,1,2
4,3,2,1

If you use this enumeration to compute determinants, you may notice that it you add the terms in the order (terms from permutations with 1 in the first place) + (terms from permutations with 2 in the first place) + ... + (terms from permutations with 4 in the first place), what you're doing is exactly expansion by minors!

-
If I'm working out the determinant of a $3 \times 3$ matrix like, then is my second term * matrix of $(2 \times 2)$ minor going to be negative? – Kaish Feb 2 '13 at 17:04
Yes, the signs will work out correctly. In the 4×4 example, the "234" subdeterminant appears with a positive sign, but the "134" and "123" subdeterminants are negative because the permutations that take the initial "1234" to "2134" and "4123" are odd. On the other hand, "1234" to "3124" is an even permutation, so the "124" subdeterminant appears with positive sign. – Henning Makholm Feb 2 '13 at 21:17
@Kaish: Why don't you use GAP? This question can be easily proved by that. – Babak S. Feb 3 '13 at 10:05
@BabakSorouh Whats GAP? – Kaish Feb 3 '13 at 14:10
@Kaish: It is a powerful software in group theory. – Babak S. Feb 3 '13 at 15:20

First of all, you have repeating permutations. For example: $(243)=(324)$ (the same with the four-cycles... there should only be 6 of them). You are missing the permutations of the structure $(--)(--)$. For example $(12)(34)$,$(13)(24)$.

-

You can list all the permutations of $1,2,3,4$ and then put each one of them in cycle notation. For example here are all the permutations of $1,2,3,4$

$[[1, 2, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 4, 2], [1, 4, 2, 3], [1, 4, 3, 2], [2, 1, 3, 4], [2, 1, 4, 3], [2, 3, 1, 4], [2, 3, 4, 1], [2, 4, 1, 3], [2, 4, 3, 1], [3, 1, 2, 4], [3, 1, 4, 2], [3, 2, 1, 4], [3, 2, 4, 1], [3, 4, 1, 2], [3, 4, 2, 1], [4, 1, 2, 3], [4, 1, 3, 2], [4, 2, 1, 3], [4, 2, 3, 1], [4, 3, 1, 2], [4, 3, 2, 1]]$

For example $[3,1,2,4]$ from above in cylce notation is $(132)$. Put in a columns so you have for each

$\begin{pmatrix} 1 & 2 & 3&4 \\ 3 & 1 & 2&4\end{pmatrix}$

So you can see $1$ goes to $3$; $3$ goes to $2$; $2$ goes to $1$ and $4$ is fixed.

$[3,4,2,1]$ is $(1324)$ in cycle notation as follows

$\begin{pmatrix} 1 & 2 & 3&4 \\ 3 & 4 & 2&1\end{pmatrix}$

$1$ goes to $3$; $3$ goes to $2$; $2$ goes to $4$; and $4$ goes to $1$

Alternatively you can go to Sagemath sign up for the online version if you are not signed up already and run

sage: S4=SymmetricGroup(4)
sage: S4.list()

to get

$[(), (3,4), (2,3), (2,3,4), (2,4,3), (2,4), (1,2), (1,2)(3,4), (1,2,3), (1,2,3,4), (1,2,4,3), (1,2,4), (1,3,2), (1,3,4,2), (1,3), (1,3,4), (1,3)(2,4), (1,3,2,4), (1,4,3,2), (1,4,2), (1,4,3), (1,4), (1,4,2,3), (1,4)(2,3)]$

-