Linear-Algebra-Done-Right Β· Unit 28 Β· Video 2 Β· Interactive Practice

Swaps, Inversions and the Sign of a Permutation

IKey Formulas

FormulaNameWhat it says
Ξ±(…,vk,…,vj,… )=βˆ’Ξ±(…,vj,…,vk,… )\alpha(\dots, v_k, \dots, v_j, \dots) = -\alpha(\dots, v_j, \dots, v_k, \dots)Swapping two inputsAn alternating form changes sign
sign⁑(j1,…,jm)=(βˆ’1)N\operatorname{sign}(j_1, \dots, j_m) = (-1)^NSign of a permutationNN = number of pairs out of order (inversions)
sign⁑(afterΒ aΒ swap)=βˆ’sign⁑(before)\operatorname{sign}(\text{after a swap}) = -\operatorname{sign}(\text{before})Swaps flip the signA swap changes NN by an odd number
Ξ±(vj1,…,vjm)=sign⁑(j1,…,jm) α(v1,…,vm)\alpha(v_{j_1}, \dots, v_{j_m}) = \operatorname{sign}(j_1, \dots, j_m)\,\alpha(v_1, \dots, v_m)Rearranging inputsOnly the sign of the permutation matters

Key Insight: (2,3,…,m,1)(2, 3, \dots, m, 1) has mβˆ’1m - 1 inversions, so moving the first input to the last slot multiplies Ξ±\alpha by (βˆ’1)mβˆ’1(-1)^{m-1}.

IICounting Inversions Swap by Swap

Every swap of two entries changes the number of inversions by an odd number, so the sign flips each time.

IIIWhere the Odd Change Comes From

The swapped pair changes the count by Β±1\pm 1; each entry between them changes it by 22, βˆ’2-2 or 00.

IVQuiz Questions

Problem 1 Β· Count the Inversions

Given: the permutation (3,1,4,2)∈perm⁑4(3, 1, 4, 2) \in \operatorname{perm} 4. Find its number of inversions NN and its sign.

How many inversions?

What is the sign?

βœ… Correct! The inversions are {1,3}\{1, 3\}, {2,3}\{2, 3\} and {2,4}\{2, 4\}, so the sign is (βˆ’1)3=βˆ’1(-1)^3 = -1.
❌ Not quite. An inversion need not be two neighbours: 22 comes after 33 even though 11 and 44 sit between them.
❌ Not quite. Check all (42)=6\binom{4}{2} = 6 pairs of numbers and ask whether the smaller one appears after the larger.
❌ Check the sign. The sign is (βˆ’1)N(-1)^N with NN the number of inversions.
Show solution

Check the six pairs of numbers in the list 3,1,4,23, 1, 4, 2:

  • {1,2}\{1, 2\}, {1,4}\{1, 4\}, {3,4}\{3, 4\}: the smaller number comes first, natural order.
  • {1,3}\{1, 3\}: 11 comes after 33. {2,3}\{2, 3\}: 22 comes after 33. {2,4}\{2, 4\}: 22 comes after 44. These are inversions.

So N=3N = 3 and sign⁑(3,1,4,2)=(βˆ’1)3=βˆ’1\operatorname{sign}(3, 1, 4, 2) = (-1)^3 = -1.

Problem 2 Β· A Cyclic Rearrangement

Given: α∈Valt(3)\alpha \in V_{\text{alt}}^{(3)} and v1,v2,v3∈Vv_1, v_2, v_3 \in V. Express α(v2,v3,v1)\alpha(v_2, v_3, v_1) in terms of α(v1,v2,v3)\alpha(v_1, v_2, v_3).

βœ… Correct! (2,3,1)(2, 3, 1) has two inversions, so its sign is +1+1.
❌ Not quite. Moving v1v_1 to the end looks like one move, but it takes two swaps: (2,3,1)(2, 3, 1) has mβˆ’1=2m - 1 = 2 inversions.
❌ Not quite. No input is repeated and nothing says the list is dependent; rearranging can only change the sign.
❌ Not quite. Rearranging inputs multiplies the value by the sign of the permutation, which is ±1\pm 1.
Show solution

The inputs are vj1,vj2,vj3v_{j_1}, v_{j_2}, v_{j_3} with (j1,j2,j3)=(2,3,1)(j_1, j_2, j_3) = (2, 3, 1). Its inversions are {1,2}\{1, 2\} and {1,3}\{1, 3\} (11 appears after both), so N=2N = 2 and the sign is +1+1:

Ξ±(v2,v3,v1)=sign⁑(2,3,1) α(v1,v2,v3)=Ξ±(v1,v2,v3).\alpha(v_2, v_3, v_1) = \operatorname{sign}(2, 3, 1)\,\alpha(v_1, v_2, v_3) = \alpha(v_1, v_2, v_3).

Check with swaps: swapping slots 11 and 33 gives βˆ’Ξ±(v1,v3,v2)-\alpha(v_1, v_3, v_2), and swapping slots 22 and 33 gives Ξ±(v1,v2,v3)\alpha(v_1, v_2, v_3).

Problem 3 Β· After One Swap

Given: a permutation with 77 inversions. Two of its entries are swapped. Which number could be the new number of inversions?

βœ… Correct! A swap changes the count by an odd number, and 4βˆ’7=βˆ’34 - 7 = -3 is odd.
❌ Not quite. That is a change of ±2\pm 2, an even number. A swap always changes the number of inversions by an odd number.
❌ Not quite. A change of 00 is even; the swapped pair alone contributes ±1\pm 1 and everything else contributes an even amount.
❌ Not quite. Use the parity of the change.
Show solution

Swapping two entries changes the number of inversions by Β±1\pm 1 (the swapped pair) plus 22, βˆ’2-2 or 00 for each entry between them, plus 00 for every other pair. The total change is odd.

From 77: a new count of 99, 55 or 77 would be a change of +2+2, βˆ’2-2 or 00, all even. Only 44 (a change of βˆ’3-3) is possible. In general, a swap turns an odd count into an even one and an even count into an odd one.

Problem 4 Β· Reversing Six Inputs

Given: α∈Valt(6)\alpha \in V_{\text{alt}}^{(6)} and v1,…,v6∈Vv_1, \dots, v_6 \in V. Express Ξ±(v6,v5,v4,v3,v2,v1)\alpha(v_6, v_5, v_4, v_3, v_2, v_1) in terms of Ξ±(v1,…,v6)\alpha(v_1, \dots, v_6).

βœ… Correct! Every one of the 1515 pairs is out of order, and (βˆ’1)15=βˆ’1(-1)^{15} = -1.
❌ Not quite. Three swaps (v1↔v6v_1 \leftrightarrow v_6, v2↔v5v_2 \leftrightarrow v_5, v3↔v4v_3 \leftrightarrow v_4) restore the order, and three is odd.
❌ Not quite. A rearrangement multiplies α\alpha by ±1\pm 1. Count the inversions of (6,5,4,3,2,1)(6, 5, 4, 3, 2, 1).
Show solution

In (6,5,4,3,2,1)(6, 5, 4, 3, 2, 1) every smaller number appears after every larger one, so all (62)=15\binom{6}{2} = 15 pairs are inversions. Hence

Ξ±(v6,v5,v4,v3,v2,v1)=(βˆ’1)15 α(v1,…,v6)=βˆ’Ξ±(v1,…,v6).\alpha(v_6, v_5, v_4, v_3, v_2, v_1) = (-1)^{15}\,\alpha(v_1, \dots, v_6) = -\alpha(v_1, \dots, v_6).

Check with swaps: exchanging slots 1↔61 \leftrightarrow 6, 2↔52 \leftrightarrow 5 and 3↔43 \leftrightarrow 4 restores the order in three swaps, an odd number.

Solved: 0 / 4