How to sort a permutation cycle in the mapping form?

188 Views Asked by At

Consider a cycle $(6\; 1\; 4\; 3\; 5\; 2 )$ of a symmetric group $S_n$ of degree $n$. This implies $6$ maps to $1$, $1$ maps to $4$, $4$ maps to $3$, $3$ maps to $5$, $5$ maps to $2$ and $2$ maps to $6$. Therefore there is a $2 \times 6 $ associated matrix $$\left(\begin{array}{ll} 1\;2\;3\;4\;5\;6 \\ 4\;6\;5\;3\;2\;1 \end{array} \right).$$ By using Mathematica, I want to write the same cycle in associated matrix form $$\left(\begin{array}{ll} 1\;2\;3\;4\;5\;6 \\ 4\;6\;5\;3\;2\;1 \end{array} \right).$$ I have to do the same for each cycle $(a\;\; b\;\; c\;\; d\;\; e\;\; f )$ of length $6$ in $S_6.$
Please suggest Mathematica commands or provide a Mathematica code.

1

There are 1 best solutions below

8
On

After a nice discussion with Rohit Kumar, which can be found in the chat linked in the comments, we came up with a solution which I have extended in order to generate all desired permutations in a loop.

We use Permutations to generate all permutations of the set $\{1,\cdots,n\}$ and use ToCycles in order to convert each permutation to cycle notation. If the length is equal to $n$, we have found a match Here is the code:

f[n_Integer]:= Module[{l={}},
    Do[
      If[Length[j]==n,AppendTo[l,{Range[n], i}]], {i, Permutations[Range[n]]}, {j,ToCycles[i]}];
{l}
]

Edit: You might need to use

Needs["Combinatorica`"] // Quiet

at the very beginning.

Example: Let us use $n=4$ for an easier example. We simply call the above function: $f[4]$ which yields to

{{{{1,2,3,4},{2,3,4,1}},{{1,2,3,4},{2,4,1,3}},{{1,2,3,4},{3,1,4,2}},{{1,2,3,4},{3,4,2,1}},{{1,2,3,4},{4,1,2,3}},{{1,2,3,4},{4,3,1,2}}}}

Converting each entry via MatrixForm to a visiualized matrix representation yields to:

$$ \begin{pmatrix} 1 &2 &3 &4 \\ 2 & 3 & 4 & 1 \end{pmatrix} \begin{pmatrix} 1 &2 &3 &4 \\ 2 & 4 & 1 & 3 \end{pmatrix} \begin{pmatrix} 1 &2 &3 &4 \\ 3 & 1 & 4 & 2 \end{pmatrix} $$

$$ \begin{pmatrix} 1 &2 &3 &4 \\ 3 & 4 & 2 & 1 \end{pmatrix} \begin{pmatrix} 1 &2 &3 &4 \\ 4 & 1 & 2 & 3 \end{pmatrix} \begin{pmatrix} 1 &2 &3 &4 \\ 4 & 3 & 1 & 2 \end{pmatrix} $$

With corresponding cyclic notations:

$$(2\ 3\ 4\ 1), \ (2\ 4\ 3\ 1), (3\ 4\ 2\ 1), (3\ 2\ 4\ 1), (4\ 3\ 2\ 1), (4\ 2\ 3\ 1)$$

Notice that there are exactly $(n-1)!$ solutions.

For $n=6$, $f[6]$ yields to the following (truncated) output:

{{{{1,2,3,4,5,6},{2,3,4,5,6,1}},{{1,2,3,4,5,6},{2,3,4,6,1,5}},{{1,2,3,4,5,6},{2,3,5,1,6,4}},{{1,2,3,4,5,6},{2,3,5,6,4,1}}, ⋯112⋯ ,{{1,2,3,4,5,6},{6,5,2,1,4,3}},{{1,2,3,4,5,6},{6,5,2,3,1,4}},{{1,2,3,4,5,6},{6,5,4,1,3,2}},{{1,2,3,4,5,6},{6,5,4,2,1,3}}}}

Using Length on $f[6]$ yields to $120=(n-1)!=(6-1)!=5!$.