Verify parity from inversions and cycle structure. Export summaries quickly for proofs and homework. Get clear results in seconds.
| Permutation | Inversions | Parity | Sign | Cycles |
|---|---|---|---|---|
| 1 2 3 4 | 0 | Even | +1 | Identity |
| 2 1 3 4 | 1 | Odd | -1 | (1 2) |
| 3 1 2 4 | 2 | Even | +1 | (1 3 2) |
| 4 3 2 1 | 6 | Even | +1 | (1 4) (2 3) |
The parity of a permutation is determined by the parity of its inversion count. For a one-line permutation p = [p1, p2, …, pn], an inversion is a pair (i, j) with i < j and pi > pj.
This calculator uses a Fenwick tree to count inversions efficiently and also shows the cycle decomposition as a supporting viewpoint.
Permutation parity is a two-class invariant that stays unchanged under relabeling and composition rules. In algebra, it partitions the symmetric group into even and odd elements, with even permutations forming a subgroup. In computation, parity acts as a quick consistency check: if a process claims to transform one ordering into another using only swaps, the final parity must match the number of swaps performed.
Counting inversions directly by scanning all pairs costs O(n²), which becomes slow for long inputs. This calculator uses a Fenwick tree approach that runs in O(n log n) while preserving exactness. The inversion count is not only a parity tool; it also measures how far a list is from being sorted, so it can support basic complexity estimates for swap-based correction routines.
A permutation can be written as disjoint cycles. While parity is computed from inversions, cycles provide verification evidence and interpretability. Each k-cycle can be expressed using k−1 transpositions, so cycle structure determines the minimal number of swaps needed to build the permutation from the identity. Seeing cycles alongside inversions helps connect group theory definitions with algorithmic outcomes.
Parity appears in determinant sign changes, alternating sums, and permutation matrices. In puzzle analysis, parity constraints explain why some states are unreachable under legal moves. In scheduling and routing, parity flags whether a sequence can be corrected using an allowed swap model. The exported summary supports audit trails when parity is part of a formal argument or grading rubric.
Treat parity as a binary property, not a magnitude score. Two permutations can share parity while having very different inversion counts. Use the sign for algebraic identities, inversions for disorder measurement, and cycles for swap planning. When reporting results, include the permutation, n, inversion count, parity, and cycle notation for clarity.
Enter integers separated by spaces, commas, or semicolons, such as 1 3 2 4 or 1,3,2,4. Values must form a true permutation of 1..n.
Parity is defined for bijections of a finite set. Restricting to 1..n ensures a one-to-one mapping with no missing or repeated elements, which makes inversion and cycle calculations valid.
Yes. Parity equals the inversion count modulo 2. The cycle decomposition is provided as supporting structure, and it also implies the minimal transposition count, which agrees with inversion parity.
The sign is +1 for even permutations and -1 for odd permutations. It matches the factor used in determinants and alternating sums over permutations.
It helps interpret how many swaps are required to build the permutation from the identity. This is useful in proofs and in swap-based correction strategies, and it is derived from the cycle structure.
Export the permutation, n, inversion count, parity, sign, and cycle notation. That combination is compact, reproducible, and usually sufficient for assignments, audits, or reference notes.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.