### 12.2.9 Product of two permutations

Permutations are functions, and so can be composed. Since cycles can be represented differently than other permutations, there are commands for composing permutations of different types.

The p1op2 command composes two permutations.

- p1op2 takes two arguments: p1 and p2, permutations.
- p1op2(p1,p2) returns the permutation p1∘ p2 obtained by composition. Note that this is the standard mathematical notation; that is, the rightmost permutation is applied first.

The c1op2 command composes a cycle and a permutation.

- c1op2 takes two arguments:
  - c1, a cycle.
  - p2, a permutation.
- c1op2(c1,p2) returns the permutation c1∘ p2 obtained by composition.

The p1oc2 command composes a permutation and a cycle.

- p1oc2 takes two arguments:
  - p1, a permutation.
  - c2, a cycle.
  p1oc2(p1,c2) returns the permutation p1∘ c2 obtained by composition.

The c1oc2 command composes two cycles.

- c1oc2 takes two arguments: c1 and c2, cycles.
- c1oc2(c1,c2) returns the permutation c1∘ c2 obtained by composition.

#### Examples

p1op2([3,4,5,2,0,1],[2,0,1,4,3,5])

| ⎡ ⎣ | 5,3,4,0,2,1 | ⎤ ⎦

c1op2([3,4,5],[2,0,1,4,3,5])

| ⎡ ⎣ | 2,0,1,5,4,3 | ⎤ ⎦

p1oc2([3,4,5,2,0,1],[2,0,1])

| ⎡ ⎣ | 4,5,3,2,0,1 | ⎤ ⎦

c1oc2([3,4,5],[2,0,1])

| ⎡ ⎣ | 1,2,0,4,5,3 | ⎤ ⎦