Unit 4: Permutations

The group of all shuffles

Shuffle a deck of cards, scramble a puzzle, relabel the corners of a triangle: each is a permutation. Permutations were the first groups ever studied, and every finite group can be found among them (Cayley's theorem, Unit 6).

123456789101112
In this unit
  1. What is a permutation?
  2. Cycle notation
  3. Composing permutations
  4. The order of a permutation
  5. Even and odd
  6. The alternating group
  7. The 15 puzzle
  8. Practice set
  9. Summary and glossary

What is a permutation?

A permutation of a set is a way of rearranging it: a function from the set to itself that sends different elements to different places and leaves nothing out. In other words, a one-to-one and onto function, also called a bijection. We'll permute the numbers \(1, 2, \ldots, n\).

Here is a permutation \(\sigma\) (the Greek letter sigma) of \(\{1, \ldots, 6\}\), drawn two ways:

The permutation \(\sigma\). Left: each number points to where \(\sigma\) sends it, so \(\sigma(1) = 3\), \(\sigma(2) = 6\), and so on. Right: following the arrows from any number eventually brings you back to it.

One compact way to write it is two-line notation, with each number above its image:

\[ \sigma = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 3 & 6 & 5 & 4 & 1 & 2 \end{pmatrix}. \]

Definition

The symmetric group \(S_n\) is the set of all permutations of \(\{1, 2, \ldots, n\}\), with composition as the operation: \(\sigma\tau\) means "first \(\tau\), then \(\sigma\)", so \((\sigma\tau)(i) = \sigma(\tau(i))\).

This is a group. Composing two bijections gives a bijection; composition of functions is associative; the identity is the permutation \(e\) that moves nothing; and the inverse \(\sigma^{-1}\) runs every arrow backwards. The order of \(S_n\) is \(n! = n(n-1)\cdots 2 \cdot 1\): there are \(n\) choices for \(\sigma(1)\), then \(n - 1\) for \(\sigma(2)\), and so on. So \(|S_3| = 6\), \(|S_4| = 24\), and \(|S_{52}|\), the number of ways to shuffle a deck of cards, has 68 digits.

The symmetries of a polygon are permutations of its corners, so \(D_n\) sits inside \(S_n\). For a triangle, every one of the \(3! = 6\) permutations of the corners is a symmetry, so \(D_3\) is all of \(S_3\). For a square, only 8 of the 24 permutations are symmetries: swapping two neighbouring corners and leaving the other two alone would tear the square.

Cycle notation

Follow \(\sigma\) starting from 1: \(1 \to 3 \to 5 \to 1\). Then from 2: \(2 \to 6 \to 2\). And 4 stays put. We record this as

\[ \sigma = (1\;3\;5)(2\;6). \]

A cycle \((a_1\;a_2\;\ldots\;a_k)\) sends \(a_1 \to a_2 \to \cdots \to a_k \to a_1\) and fixes every other number. It has length \(k\), and is called a \(k\)-cycle. A 2-cycle \((a\;b)\), which just swaps \(a\) and \(b\), is called a transposition. Numbers that don't move are usually left out, so \((1\;3\;5)(2\;6)\) and \((1\;3\;5)(2\;6)(4)\) mean the same. The same cycle can start anywhere: \((1\;3\;5) = (3\;5\;1) = (5\;1\;3)\).

Theorem

Every permutation is a product of disjoint cycles (cycles with no numbers in common). This decomposition is unique, apart from the order of the cycles and fixed points written or left out. Disjoint cycles commute.

Proof

Start at any number \(a\) and follow \(a, \sigma(a), \sigma^2(a), \ldots\). There are only \(n\) numbers, so some value repeats. The first repeat must be \(a\) itself: if \(\sigma^i(a) = \sigma^j(a)\) with \(0 < i < j\), then, since \(\sigma\) is one-to-one, \(\sigma^{i-1}(a) = \sigma^{j-1}(a)\), an earlier repeat. So the numbers visited form a cycle. Pick a number not yet visited and repeat. The cycles found are disjoint, because each number lies on exactly one path of arrows, and their product is \(\sigma\), since each cycle does exactly what \(\sigma\) does on its own numbers. The cycles are forced: the cycle containing \(a\) must be \((a\;\sigma(a)\;\sigma^2(a)\;\ldots)\).

Disjoint cycles commute because they act on different numbers: whichever is done first, each number is moved by at most one of them. ∎

Inverses are easy in cycle notation: run each cycle backwards. For example, \(\sigma^{-1} = (5\;3\;1)(6\;2) = (1\;5\;3)(2\;6)\).

Composing permutations

To compose, follow each number through the permutations from right to left. Take \(\tau = (1\;2\;3)\) (tau) and \(\sigma = (3\;4)\) in \(S_4\), and compute \(\sigma\tau\), "first \(\tau\), then \(\sigma\)":

Composition, drawn as stacked arrows. Green arrows are \(\tau\), violet arrows are \(\sigma\). Left: \(\tau\) first, then \(\sigma\). Following the arrows from top to bottom gives \(\sigma\tau = (1\;2\;4\;3)\). Right: the other order gives \(\tau\sigma = (1\;2\;3\;4)\), a different permutation.

By hand: \(\tau\) sends 1 to 2, and \(\sigma\) leaves 2 alone, so \(\sigma\tau\) sends 1 to 2. Then 2 goes to 3 under \(\tau\), and 3 goes to 4 under \(\sigma\): so \(2 \to 4\). Continuing, \(4 \to 4 \to 3\) and \(3 \to 1 \to 1\). Hence \(\sigma\tau = (1\;2\;4\;3)\). The other order, \(\tau\sigma\), gives \((1\;2\;3\;4)\). So \(S_4\) is not abelian. Neither is \(S_n\) for any \(n \ge 3\): already \((1\;2)\) and \((2\;3)\) don't commute (Practice 2).

A warning about conventions

We compose right to left, like functions, matching \(ab\) = "first \(b\), then \(a\)" from Unit 1. Many books and computer algebra systems compose permutations left to right instead. In that convention \(\sigma\tau\) means "first \(\sigma\), then \(\tau\)", which is our \(\tau\sigma\): the same cycle type, but usually a different permutation. Always check which convention is in use.

The order of a permutation

A \(k\)-cycle has order \(k\): applying \((1\;3\;5)\) three times moves each of 1, 3, 5 three steps round its cycle, back to the start, while after one or two steps 1 has not yet returned. In general, after \(j < k\) steps \(a_1\) has moved to \(a_{1+j} \neq a_1\). For a product of disjoint cycles, the cycles turn independently.

Theorem

The order of a permutation is the least common multiple of the lengths of its disjoint cycles.

Proof

Write \(\sigma = c_1c_2\cdots c_m\) with disjoint cycles of lengths \(k_1, \ldots, k_m\). They commute, so \(\sigma^j = c_1^j c_2^j \cdots c_m^j\). The factors move disjoint sets of numbers, so the product is \(e\) exactly when every factor is \(e\), that is, when every \(k_i\) divides \(j\) (Unit 3). The smallest such \(j \ge 1\) is \(\operatorname{lcm}(k_1, \ldots, k_m)\). ∎

So \(\sigma = (1\;3\;5)(2\;6)\) has order \(\operatorname{lcm}(3, 2) = 6\). Warning: this needs the cycles to be disjoint. \((1\;2)(2\;3) = (1\;2\;3)\) has order 3, not \(\operatorname{lcm}(2, 2) = 2\).

The lengths of the disjoint cycles, listed in decreasing order and counting fixed points as cycles of length 1, form the cycle type. Here are all 24 elements of \(S_4\), sorted by cycle type:

Cycle typeExampleHow manyOrderEven or odd
1, 1, 1, 1\(e\)11even
2, 1, 1\((1\;2)\)62odd
2, 2\((1\;2)(3\;4)\)32even
3, 1\((1\;2\;3)\)83even
4\((1\;2\;3\;4)\)64odd

(The last column is explained in the next section.)

Going deeper: the largest order in \(S_n\)

To get a large order in \(S_n\), split \(n\) into cycle lengths with a large least common multiple. In \(S_7\), one 7-cycle has order 7, but a 3-cycle and a 4-cycle together have order \(\operatorname{lcm}(3, 4) = 12\), and nothing does better. The largest order in \(S_n\) is called Landau's function \(g(n)\): \(g(7) = 12\), \(g(10) = 30\) from lengths \(2, 3, 5\), and for a deck of 52 cards it is 180,180, so no shuffle of a deck, repeated, takes longer than that to bring it back to order. Landau proved in 1902 that \(\ln g(n)\) grows like \(\sqrt{n \ln n}\).

Even and odd

Any rearrangement can be done by swapping two things at a time. In symbols, every cycle is a product of transpositions:

\[ (a_1\;a_2\;\ldots\;a_k) = (a_1\;a_k)(a_1\;a_{k-1})\cdots(a_1\;a_3)(a_1\;a_2). \]

(Check with \(k = 3\): \((1\;3)(1\;2)\) sends 1 to 2, 2 to 1 to 3, and 3 to 1, which is \((1\;2\;3)\).) So a \(k\)-cycle is a product of \(k - 1\) transpositions, and by the cycle theorem every permutation is a product of transpositions. The transpositions generate \(S_n\).

The number of transpositions is not fixed: \((1\;2) = (1\;3)(2\;3)(1\;3)\) uses one or three. But it is always odd for \((1\;2)\). This is not obvious, and to see it we count crossings.

An inversion of a permutation \(\pi\) (pi) is a pair \(i < j\) with \(\pi(i) > \pi(j)\): a pair whose order \(\pi\) reverses. Draw the arrows of \(\pi\) as straight lines. Arrows starting at \(i < j\) cross exactly when their endpoints come in the opposite order, \(\pi(i) > \pi(j)\): when their pair is an inversion.

Crossings of the arrows of πTwo rows of the numbers 1 to 5, with arrows for the permutation π: 1 to 2, 2 to 4, 3 to 5, 4 to 1, 5 to 3. Each crossing of two arrows is marked by a red dot. There are 5 crossings, one for each pair of numbers whose order π reverses.1122334455
Crossings count inversions. For \(\pi = (1\;2\;4)(3\;5)\), the reversed pairs are \(\{1, 4\}\), \(\{2, 4\}\), \(\{2, 5\}\), \(\{3, 4\}\) and \(\{3, 5\}\): five inversions, five crossings.

Theorem (parity)

If a permutation \(\pi\) is written as a product of \(k\) transpositions, then \(k\) has the same parity (even or odd) as the number of inversions of \(\pi\). In particular, no permutation is both a product of an even number of transpositions and a product of an odd number.

Proof

Step 1. Call \((i\;\;i{+}1)\) an adjacent transposition. Write \(\pi\) as the list \(\pi(1), \pi(2), \ldots, \pi(n)\); an inversion is a pair of entries with the larger one first. Composing on the right with \((i\;\;i{+}1)\) gives \(\pi(i\;\;i{+}1)\), whose list is the same except that the neighbouring entries in places \(i\) and \(i + 1\) are swapped. Those two entries change their order. Any other pair of entries keeps its left-to-right order, since nothing lies between places \(i\) and \(i + 1\). So the number of inversions changes by exactly 1, up or down.

Step 2. Any transposition \((i\;j)\) with \(i < j\) is a product of an odd number of adjacent ones:

\[ (i\;j) = (i\;\;i{+}1)(i{+}1\;\;i{+}2)\cdots(j{-}1\;\;j)\cdots(i{+}1\;\;i{+}2)(i\;\;i{+}1), \]

with \(2(j - i) - 1\) factors. For example, \((1\;4) = (1\;2)(2\;3)(3\;4)(2\;3)(1\;2)\). (The product reads the same backwards, so the order of composition doesn't matter here.)

Step 3. Now suppose \(\pi = t_1t_2\cdots t_k\) with each \(t_i\) a transposition. Replace each by an odd number of adjacent transpositions. The total count has the same parity as \(k\). Build \(\pi\) from \(e\) (which has 0 inversions) by composing on the right with these adjacent transpositions one at a time; each step changes the number of inversions by 1. So the number of inversions of \(\pi\) has the same parity as \(k\). ∎

Definition

A permutation is even if it is a product of an even number of transpositions, and odd otherwise. Its sign is \(\operatorname{sgn}(\pi) = +1\) if \(\pi\) is even and \(-1\) if it is odd.

Writing products side by side shows that \(\operatorname{sgn}(\sigma\tau) = \operatorname{sgn}(\sigma)\operatorname{sgn}(\tau)\): even times even is even, odd times odd is even, and even times odd is odd. A \(k\)-cycle is a product of \(k - 1\) transpositions, so its sign is \((-1)^{k-1}\). Watch out: cycles of even length are odd permutations. So \((1\;2\;4)(3\;5)\) is odd (even times odd), in agreement with its five crossings.

The sign of a permutation appears all over mathematics. The determinant of a matrix, for instance, is a sum over all permutations, each term carrying a sign.

The alternating group

Definition

The alternating group \(A_n\) is the set of even permutations in \(S_n\).

Theorem

\(A_n\) is a subgroup of \(S_n\). For \(n \ge 2\), it contains exactly half the permutations: \(|A_n| = \frac{n!}{2}\).

Proof

\(e\) is even (zero transpositions). A product of two even permutations is even. If \(\pi = t_1\cdots t_k\), then \(\pi^{-1} = t_k\cdots t_1\), since each transposition is its own inverse; so the inverse of an even permutation is even. Hence \(A_n\) is a subgroup.

For the count, the rule \(\pi \mapsto \pi(1\;2)\) turns even permutations into odd ones and odd into even. Doing it twice gives back \(\pi\), so it matches the even and odd permutations one to one. There are equally many of each. ∎

\(A_3 = \{e, (1\;2\;3), (1\;3\;2)\}\): the three rotations of the triangle. Flips of a triangle swap two corners, so they're odd. \(A_4\) has 12 elements: \(e\), the eight 3-cycles and the three products \((1\;2)(3\;4)\), \((1\;3)(2\;4)\), \((1\;4)(2\;3)\). It will reappear in Unit 8 as the rotations of a tetrahedron. And \(A_5\), with 60 elements, is the rotation group of the icosahedron, and the key to why there is no general formula, using roots, for equations of degree five (Unit 12).

The 15 puzzle

Around 1880 a sliding puzzle swept America and then Europe: fifteen numbered tiles in a 4 by 4 frame, with one empty square. You slide a tile into the gap, one move at a time. Years later the puzzle-maker Sam Loyd made famous a challenge: start with 14 and 15 swapped, and put everything in order.

The impossible challenge. The start and the goal differ only by swapping two tiles. No sequence of slides gets from one to the other.

Theorem

Loyd's position cannot be solved.

Proof

Call the empty square tile 16. Then every arrangement is a permutation of the 16 squares, and every slide swaps tile 16 with a neighbour: it composes the arrangement with one transposition.

Colour the board like a chessboard. Each slide moves the empty square to a square of the other colour. Both the start and the goal have the empty square in the bottom-right corner, so any solution must use an even number of slides. An even number of transpositions makes an even permutation.

But the start and the goal differ by the single transposition \((14\;\;15)\), which is odd. A solution would make the slides multiply to \((14\;\;15)\), but a product of an even number of transpositions is even. So no solution exists. ∎

Parity is the only obstruction: every arrangement with the gap in the corner that differs from the goal by an even permutation can be solved. So exactly half of the \(15!\) such arrangements are solvable. Both halves were proved in 1879: William Johnson showed the odd half impossible, and William Story showed the even half solvable.

History

Lagrange, Ruffini and Cauchy studied permutations long before abstract groups existed. Cauchy developed much of this unit's machinery, including the systematic use of cycles, in papers from 1815 to 1844. Camille Jordan's Traité des substitutions (1870), the first book on group theory, was almost entirely about groups of permutations. The 15 puzzle was devised in the 1870s, probably by the postmaster Noyes Chapman; Sam Loyd later claimed falsely to have invented it.

Practice set

Mixed questions covering the whole unit. Try each one before opening the answer.

1. In \(S_6\), let \(\alpha\) send \(1, 2, 3, 4, 5, 6\) to \(3, 5, 6, 1, 2, 4\) respectively. Write \(\alpha\) in cycle notation, and find its order and sign.

Show answer

Following arrows: \(1 \to 3 \to 6 \to 4 \to 1\) and \(2 \to 5 \to 2\). So \(\alpha = (1\;3\;6\;4)(2\;5)\). Its order is \(\operatorname{lcm}(4, 2) = 4\). The 4-cycle is odd and the transposition is odd, so \(\alpha\) is even: \(\operatorname{sgn}(\alpha) = +1\).

2. Compute \((1\;2)(2\;3)\) and \((2\;3)(1\;2)\).

Show answer

For \((1\;2)(2\;3)\), apply \((2\;3)\) first: \(1 \to 1 \to 2\), \(2 \to 3 \to 3\), \(3 \to 2 \to 1\). So it is \((1\;2\;3)\). For \((2\;3)(1\;2)\): \(1 \to 2 \to 3\), \(2 \to 1 \to 1\), \(3 \to 3 \to 2\), giving \((1\;3\;2)\). The two answers are inverse to each other, because each transposition is its own inverse: \(\big((1\;2)(2\;3)\big)^{-1} = (2\;3)^{-1}(1\;2)^{-1} = (2\;3)(1\;2)\).

3. What is the order of \((1\;4)(2\;5\;3)\) in \(S_6\)? What is the largest order of an element of \(S_7\)?

Show answer

\(\operatorname{lcm}(2, 3) = 6\). In \(S_7\), the possible cycle types give orders such as 7 (a 7-cycle), 10 (lengths 5, 2), 12 (lengths 4, 3) and 6 (lengths 3, 2, 2 or 6, 1). The largest is 12.

4. Find the inverse of \(\pi = (1\;2\;4)(3\;5)\), and check your answer by composing.

Show answer

Run each cycle backwards: \(\pi^{-1} = (4\;2\;1)(5\;3) = (1\;4\;2)(3\;5)\). Check \(\pi\pi^{-1}\): 1 goes to 4 under \(\pi^{-1}\), then to 1 under \(\pi\); 2 goes to 1, then back to 2; 4 goes to 2, then to 4; and 3, 5 are swapped twice. So \(\pi\pi^{-1} = e\).

5. Is \((1\;2\;3\;4)\) in \(A_4\)? List the orders of the elements of \(A_4\).

Show answer

No: a 4-cycle is a product of 3 transpositions, so it is odd. The elements of \(A_4\) are \(e\) (order 1), eight 3-cycles (order 3) and three products of two disjoint transpositions (order 2). Notice that \(A_4\) has no element of order 6, even though 6 divides 12.

6. Show that every element of \(A_n\) (\(n \ge 3\)) is a product of 3-cycles. Hint: check that \((a\;b)(b\;c) = (a\;b\;c)\) for distinct \(a, b, c\).

Show answer

An even permutation is a product of transpositions taken in pairs, so it is enough to handle a pair \((a\;b)(c\;d)\). If the pair is equal, the product is \(e\), an empty product of 3-cycles. If they share one number, write them as \((a\;b)(b\;c) = (a\;b\;c)\) (check: \(c \to b \to a\), \(a \to a \to b\), \(b \to c \to c\)). If they are disjoint, insert \(e = (b\;c)(b\;c)\) in the middle: \((a\;b)(c\;d) = (a\;b)(b\;c)\,(b\;c)(c\;d) = (a\;b\;c)(b\;c\;d)\).

Summary and glossary

  1. \(S_n\), the permutations of \(n\) objects under composition, is a group of order \(n!\); it is non-abelian for \(n \ge 3\).
  2. Every permutation is a product of disjoint cycles, uniquely; its order is the lcm of the cycle lengths.
  3. Every permutation is a product of transpositions, and the parity of their number is always the same.
  4. \(\operatorname{sgn}\) is multiplicative, and a \(k\)-cycle has sign \((-1)^{k-1}\).
  5. The even permutations form the alternating group \(A_n\), of order \(n!/2\). Parity shows the 15 puzzle with two tiles swapped is unsolvable.
Permutation
A bijection from a set to itself.
\(S_n\)
The symmetric group: all permutations of \(\{1, \ldots, n\}\).
Cycle
\((a_1\;\ldots\;a_k)\): \(a_1 \to a_2 \to \cdots \to a_k \to a_1\), fixing the rest.
Transposition
A 2-cycle, swapping two numbers.
Cycle type
The lengths of the disjoint cycles of a permutation.
Inversion
A pair \(i < j\) with \(\pi(i) > \pi(j)\).
Even, odd, sign
A product of an even or odd number of transpositions; sign \(+1\) or \(-1\).
\(A_n\)
The alternating group: the even permutations in \(S_n\).
Powered by Webloyt | Report abuse