# Product of two permutations: p1op2 c1op2 p1oc2 c1oc2

### 5.9.9 Product of two permutations: p1op2 c1op2 p1oc2 c1oc2

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.

Warning.
Composition is done using the standard mathematical notation; that is, the function given as the second argument is performed first.

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.

#### Example.

Input:

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

Output:

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

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.

#### Example.

Input:

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

Output:

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

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.

#### Example.

Input:

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

Output:

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

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.

#### Example.

Input:

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

Output:

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