An odd permutation is one that takes an odd number of two-item swaps to build. A single swap is odd; so is the reversal of four items, and so is any cycle of even length. Half of all permutations of n ≥ 2 items are odd, and their sign is −1. This calculator counts the odd permutations of n items, lists them when n is small, and tests any permutation you type, showing its cycles, inversions and minimum number of swaps.
How to use the odd permutations calculator
- Choose Count odd permutations or Check a permutation.
- To count, enter Number of items (n) — anything from 0 to 10,000. Tick List the odd permutations to print all of them for n ≤ 6.
- To check, type the permutation as the new order of 1…n, such as 3 1 2 5 4, or as cycles, such as (1 3 2)(4 5). If cycles overlap, they are multiplied right to left.
- Read the parity and sign on the tape. The steps and the cycle table show how many swaps each cycle needs.
Formulas
For n ≥ 2:
For a permutation with c disjoint cycles on n items (fixed points included):
The quantity n − c is also the smallest number of swaps that produces σ.
Worked example
Count: 4 items have 4! = 24 permutations, and 24 ÷ 2 = 12 of them are odd.
Check 3 1 2 5 4: follow each number: 1→3→2→1 and 4→5→4. Cycles: (1 3 2)(4 5).
Swaps: (3 − 1) + (2 − 1) = 3, which is odd. Inversions: (3, 1), (3, 2) and (5, 4) — also 3. The permutation is odd, sign −1.
The twelve odd permutations of four items are the six single swaps, such as (1 2), and the six 4-cycles, such as (1 2 3 4).
Spotting odd permutations quickly
- Count even-length cycles. A permutation is odd exactly when it has an odd number of cycles of even length. (1 3 2)(4 5) has one even-length cycle, so it is odd.
- Reversals. Reversing n items takes ⌊n/2⌋ swaps, so reversing 2, 3, 6 or 7 items is odd, and reversing 4, 5, 8 or 9 items is even.
- Products. Odd ∘ odd = even and odd ∘ even = odd, just like adding odd and even numbers.
- Inverses. Undoing a permutation takes the same number of swaps, so σ and σ⁻¹ always have the same parity.
The puzzle that cannot be solved
The best-known use of parity is the 15 puzzle: fifteen numbered tiles and one gap in a 4 × 4 frame. In the 1880s a version circulated with tiles 14 and 15 swapped, and a prize was reportedly offered for restoring the order. It cannot be done. Each slide swaps the gap with a tile, and if the gap is to end where it started it must make as many moves up as down and as many left as right — an even number of slides in total. So every reachable arrangement is an even permutation of the sixteen squares, while swapping two tiles alone is odd. The same reasoning explains why a Rubik’s Cube reassembled with two edge pieces exchanged can never be solved by turning faces.
Sign and determinants
The sign of a permutation, +1 for even and −1 for odd, multiplies like an ordinary number: sgn(στ) = sgn(σ) · sgn(τ). It is the source of the alternating signs in determinants. In the Leibniz formula, a determinant is the sum over all n! permutations of a product of entries, and each odd permutation contributes with a minus sign. That is also why swapping two rows of a matrix flips the sign of its determinant.
To count the even permutations instead, open the even permutations calculator; for the total n!, see the factorial calculator.
Frequently asked questions
What is an odd permutation?
A permutation is odd if it can be written as an odd number of swaps of two items. A single swap such as (1 2) is odd, and so is any cycle of even length, such as (1 2 3 4), which takes three swaps.
How many odd permutations are there?
For n ≥ 2 there are n!/2, exactly as many as even ones. Four items have 24 permutations, 12 of them odd. With fewer than two items there are no odd permutations.
Do the odd permutations form a group?
No. The identity is even, and composing two odd permutations gives an even one, so the odd permutations are not closed under composition. They form the other coset of the alternating group Aₙ.
Can a permutation be written with both an odd and an even number of swaps?
No. A permutation can be written as many different products of swaps, but the number of swaps always has the same parity. That is why the sign +1 or −1 is well defined.
What does the sign of a permutation mean?
The sign, written sgn(σ), is +1 for even permutations and −1 for odd ones. It appears in the formula for determinants and multiplies like a number: sgn(στ) = sgn(σ) × sgn(τ).