Lesson 7

Permutations

Goal

Write a permutation in cycle notation, multiply two (in GAP's order), invert one, and read off the order of an element. The atoms of every permutation group are still to come.

Concept

A permutation is a bijection of {1, 2, …, n}, written in cycle notation: (1,2,3) sends 1→2, 2→3, 3→1 and fixes everything else. GAP permutations are first-class values you can multiply, invert, and raise to powers. The one thing that will trip you: GAP composes left to right: p*q means "do p, then q" - the opposite of the right-to-left convention in much of the math literature. Permutations act on points on the right: i^p is "where p sends i."

Commands to try

p := (1,2,3);

A 3-cycle. GAP echoes it back in cycle notation, fixed points omitted.

1^p;
3^p;

Expect 2 then 1. i^p applies p to the point i. (Yes, ^ - the same symbol as powers; for an integer and a permutation it means "act".)

q := (2,3);
p * q;

Predict first. p*q is "apply p, then q." Track point 1: p sends 1→2, then q sends 2→3, so 1 → 3. Work out 2 and 3 likewise, then check GAP. If you expected right-to-left composition you'll get the inverse of the right answer. That's the convention trap, better get used to it now.

p^-1;

Expect (1,3,2) - the inverse cycle reversed.

Order(p);

Expect 3. The order of an element is the smallest k>0 with p^k = (). For a single cycle it's the cycle length.

p^3;

Expect () : the identity permutation, printed as empty parentheses.

r := (1,2)(3,4);
Order(r);
LargestMovedPoint(r);

Expect order 2 (product of disjoint 2-cycles, lcm of lengths) and largest moved point 4. LargestMovedPoint is the biggest point actually permuted - useful to know "what n am I really in."

Predict-then-check

Let a := (1,2,3,4,5) and b := (1,2). Predict, then check:

a := (1,2,3,4,5);; b := (1,2);;
Order(a);
Order(a*b);
a*b;
b*a;

Two predictions matter: the order of a*b, and whether a*b = b*a (do these permutations commute?). Commit to both before evaluating.

Exercise

  1. Let s := (1,2,3,4) and t := (2,4). Compute s*t and t*s by hand (tracking each point), then verify. Are they equal?
  2. Find Order((1,2,3)(4,5)) by reasoning (lcm of cycle lengths) before checking.
  3. Build the permutation that sends 1→3, 2→1, 3→2 and fixes 4,5. Write it in cycle notation, confirm with 1^p, 2^p, 3^p.
  4. What is LargestMovedPoint( () ) for the identity? Predict, then check.

Pitfalls

  • Composition is left-to-right. p*q = "p then q". Much of the textbook world does it the other way; GAP does not. When a product looks "backwards," this is why.
  • i^p applies p to a point; p^k is the power; p^q = q^-1*p*q is conjugation. Same ^, three meanings by operand type - read the types.
  • The identity prints as (). p^Order(p) is always ().
  • Disjoint cycles commute and the element's order is the lcm of their lengths; overlapping cycles don't commute and you must compose them.
  • Permutations have no fixed n : (1,2,3) lives in any S_n with n≥3. LargestMovedPoint tells you the support, not the ambient degree.
← Back to Learning GAP - Part 1: Foundations