Determines the sign sgn(π) = (−1)^(n−z) of a permutation from its disjoint cycle decomposition — even (+1) or odd (−1).
Two-line notation — π(i) below each position i.
π=
Degreen = 3
Explanation
Motivation
A permutationπ of {1,…,n} is a bijection of that set onto
itself. Every permutation can be written as a product of transpositions
(swaps of two elements) — in many ways, but the parity of the number of
transpositions is invariant. The sign (signum)
sgn(π)∈{+1,−1} records exactly that parity: +1 for an
even permutation, −1 for an odd one.
The sign is everywhere: it defines the determinant through the Leibniz
formula, the alternating groupAn (the kernel of the sign map), and the
signs in countless combinatorial identities.
Formal definition
Write π in one-line notation, i.e. as the list of images
(π(1),π(2),…,π(n)). Classically the sign is defined via
inversions:
More practical — and the route this calculator takes — is the cycle
decomposition. Every permutation factors uniquely into disjoint cycles.
If z is their number (fixed points count as 1-cycles), then
sgn(π)=(−1)n−z.
The exponent k=n−z is the minimum number of transpositions whose
product is π: a cycle of length ℓ is a product of ℓ−1
transpositions, and the cycle lengths sum to n.
Worked example
Take π=(2,1,3) in one-line notation — that is, π(1)=2,
π(2)=1, π(3)=3 (the calculator's preset above).
Find the cycles. Start at 1: 1↦2↦1 closes the cycle
(12). That leaves 3: 3↦3 is the fixed point (3). So
π=(12)(3),z=2.
Compute the sign. With n=3 and z=2:
sgn(π)=(−1)n−z=(−1)3−2=(−1)1=−1.
So π is odd — as is plain to see: π=(12) is a single
transposition.
Common mistakes
Forgetting fixed points:z counts all cycles, including 1-cycles. Drop
the fixed points and the exponent n−z comes out wrong.
Mixing one-line and cycle notation:(2,1,3) as one-line notation is the
permutation with π(1)=2 — not the cycle (213).
Not a valid permutation: each of 1,…,n must appear exactly once.
Duplicate or missing values are not a permutation — the calculator rejects such
input.
Confusing parity with the value: the sign is always +1 or −1, never the
exponent itself.