MathsDiscrete Math

Permutation Group
calculator.

Multiply permutations in cycle notation, and see the order, sign and inverse of each.

How it's worked out

A permutation of 1 to n is a rearrangement: it sends each number to exactly one number, and no two to the same place. In cycle notation (1 2 3)(4 5) means 1 goes to 2, 2 goes to 3, 3 goes back to 1, and 4 and 5 swap. A number that does not appear stays where it is. One-line notation lists the images in order instead, so the same permutation of 1 to 5 is 2 3 1 5 4.

Which one acts first. Most textbooks treat a permutation as a function, so σ∘τ means apply τ first and then σ, the way f(g(x)) applies g first. Judson/05%3A_Permutation_Groups/5.01%3A_Definitions_and_Notation) puts it plainly: to compute στ, do τ first and then σ. Some books and software read left to right instead. Composing left to right gives the same permutation as composing the other way round in the other order, so σ∘τ left to right is τ∘σ right to left.

Order. The order of σ is the smallest number of times you must apply it to get every number back. Written as disjoint cycles, which share no numbers, the order is the least common multiple/06:_Permutation_and_Dihedral_Groups/6.02:_Symmetric_Groups) of the cycle lengths.

ord⁡(σ)\displaystyle \operatorname{ord}(\sigma)=lcm⁡(ℓ1,ℓ2,…,ℓm)\displaystyle {}= \operatorname{lcm}(\ell_1, \ell_2, \ldots, \ell_m)

Sign. A swap of two numbers is a transposition. A cycle of length k can be written as k − 1 transpositions, so the total over all cycles decides whether σ is even or odd. Even permutations have sign +1 and odd ones −1, and the even ones form the alternating group, which holds half of the permutations.

(a1 a2 ⋯ ak)\displaystyle (a_1\ a_2\ \cdots\ a_k)=(a1 ak)(a1 ak−1)⋯(a1 a2)\displaystyle {}= (a_1\ a_k)(a_1\ a_{k-1})\cdots(a_1\ a_2)

Cycle type and conjugates. The cycle type is the list of cycle lengths. Conjugating σ by τ, written τστ⁻¹, renames every number a in the cycles of σ as τ(a). So conjugates share a cycle type, and in the symmetric group two permutations with the same cycle type are always conjugate. DLMF 26.4.7 counts the permutations of each type.

n!1a1a1!2a2a2!⋯nanan!\frac{n!}{1^{a_1}a_1!\;2^{a_2}a_2!\cdots n^{a_n}a_n!}

Worked examples

Checking a textbook product in S5

Take σ = (1 2 3)(4 5) and τ = (2 4), right to left, so τ acts first. Follow 2: τ sends it to 4, then σ sends 4 to 5. Follow 4: τ sends it to 2, then σ sends 2 to 3. Doing this for each number gives σ∘τ = (1 2 5 4 3).

The product is a single 5-cycle, so its order is 5 and it is even. Read left to right, the same two inputs give (1 4 5 2 3), which is τ∘σ in the usual order. The two answers differ, so σ and τ do not commute.

For σ itself the cycles have lengths 3 and 2, so its order is 6. Its inverse is (1 3 2)(4 5), and conjugating by τ swaps the labels 2 and 4 to give (1 4 3)(2 5).

Open this example in the tool

The smallest pair that does not commute

In S3, with σ = (1 2 3) and τ = (1 2), the product σ∘τ is (1 3) while τ∘σ is (2 3). Both are swaps, but of different pairs, so the order of multiplication matters even in a group of only 6 permutations.

To solve σ∘x = τ, apply σ⁻¹ on the left of both sides. That gives x = σ⁻¹∘τ = (2 3), and multiplying back, σ∘x is (1 2) again. Writing x = τ∘σ⁻¹ instead is a common slip, and it answers a different equation.

Open this example in the tool

A shuffle written in one-line notation

Card 1 goes to place 2, card 2 to place 4, and so on, which is the one-line list 2 4 6 1 3 5. As cycles it is (1 2 4)(3 6 5), two 3-cycles.

So the shuffle repeated 3 times puts every card back where it started. It is even, and 40 of the 720 permutations of six cards have this same cycle type.

Open this example in the tool

Reading your result

Overlapping cycles must be multiplied first. The lcm rule needs disjoint cycles. For (1 2 3 4)(2 6 7)(3 9), the lengths 4, 3 and 2 suggest 12, but multiplied out the permutation is (1 2 6 7 3 9 4) with order 7. The tool always rewrites the input as disjoint cycles before it reads the order.

A 4-cycle is odd. It needs 3 transpositions, so (1 2 3 4) has sign −1, while the 3-cycle (1 2 3) uses 2 and has sign +1. The sign of a cycle is the opposite of what its length suggests.

Negative powers run backward. σ to the power −1 is the inverse, found by reading each cycle in reverse. For the 5-cycle (1 2 3 4 5) that is (1 5 4 3 2). Powers repeat every order steps, so any power can be cut down to one between 0 and the order.

Common mistakes

  • Composing in the wrong order. If your book writes στ and means τ first, a left to right product gives τσ instead. Check one number by hand before you trust a whole answer.
  • Reading the order off overlapping cycles. Multiply into disjoint cycles first, then take the lcm of their lengths.
  • Counting a cycle's length as its number of swaps. A k-cycle uses k − 1 transpositions, so a 3-cycle is even and a 2-cycle is odd.
  • Mixing up one-line and cycle notation. The list 3 1 2 is the permutation (1 3 2), but the cycle (3 1 2) is (1 2 3). Brackets tell the tool which one you mean.

Questions people ask

Write it as disjoint cycles and take the least common multiple of their lengths. (1 2)(3 4 5) has lengths 2 and 3, so its order is 6. If the cycles share numbers, multiply them out first, since the rule fails for overlapping cycles.

Sources