Previous Up Next

6.9.10  Signature of a permutation: signature

Every permutation can be decomposed into a product of transpositions (cycles with only two elements). The number of transpositions is not unique, but for any permutation the number will be either odd or even. The signature of a permutation is equal to:

The signature of a cycle of size k is: (−1)k+1.

The signature command computes the signature of a permutation.


Example.
Input:

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

Output:

−1

Previous Up Next