Lesson 29 +40 XP

Groups and Coding: Group Codes & Error Correction

Groups and Coding: Group Codes & Error Correction

When bits travel over a noisy channel some may flip. Coding theory adds redundant bits so the receiver can detect and even correct errors. Group theory makes the analysis clean.

1. Words, Weight and Distance

  • B = {0, 1}; a word of length n is an element of Bⁿ (e.g. 1101 ∈ B⁴).
  • (Bⁿ, ⊕) is an abelian group under bitwise XOR (0 ⊕ 0 = 0, 0 ⊕ 1 = 1 ⊕ 0 = 1, 1 ⊕ 1 = 0). Identity 00…0; every word is its own inverse.
  • Weight w(x) = number of 1s in x. w(1101) = 3.
  • Hamming distance d(x, y) = number of positions where x and y differ = w(x ⊕ y).

x = 011, y = 001: x ⊕ y = 010, d(x, y) = 1.

d is a metric: d(x, y) ≥ 0, d(x, y) = d(y, x), and d(x, z) ≤ d(x, y) + d(y, z).

2. Encoding Functions

An (m, n) encoding function is a one-one map e : Bᵐ → Bⁿ (n > m). The image C = e(Bᵐ) is the code, its elements codewords.

The minimum distance of e is the smallest distance between two distinct codewords.

Error detection and correction balls around codewords at distance dError detection and correction balls around codewords at distance d

Detection: e can detect all errors of weight ≤ k iff the minimum distance is ≥ k + 1. Correction: e can correct all errors of weight ≤ k iff the minimum distance is ≥ 2k + 1.

Why? If codewords are ≥ 2k + 1 apart, balls of radius k around them do not overlap, so a word with ≤ k errors is closer to its true codeword than to any other.

Solved 1 - (2, 4) code. e(00) = 0000, e(10) = 0110, e(01) = 1011, e(11) = 1100.

PairXORDistance
x₀, x₁01102
x₀, x₂10113
x₀, x₃11002
x₁, x₂11013
x₁, x₃10102
x₂, x₃01113

Minimum distance = 2 → detects k + 1 = 2 ⇒ k = 1 error; corrects 2k + 1 = 2 ⇒ k = 1/2 ⇒ 0 errors.

Solved 2-parity-check (m, m + 1) code. Append a bit making the number of 1s even: 101 → 1010. Minimum distance 2: detects any single error, corrects none.

Solved 3-triple repetition (1, 3) code. 0 → 000, 1 → 111. Minimum distance 3: detects 2 errors, corrects 1 (majority vote).

3. Group Codes

A code C ⊆ Bⁿ is a group code if C is a subgroup of (Bⁿ, ⊕) - i.e. closed under ⊕ (for a finite non-empty set that suffices).

Theorem. For a group code, minimum distance = minimum weight of a non-zero codeword. Proof. d(x, y) = w(x ⊕ y), and x ⊕ y is itself a non-zero codeword when x ≠ y. Conversely w(x) = d(x, 0) and 0 ∈ C. ∎

This cuts the work from C(N, 2) pair comparisons to N − 1 weights.

Solved 4 (PYQ). Show the (2, 5) encoding e(00) = 00000, e(01) = 01110, e(10) = 10101, e(11) = 11011 is a group code.

⊕00000011101010111011
0000000000011101010111011
0111001110000001101110101
1010110101110110000001110
1101111011101010111000000
  • Closure: every entry is a codeword ✓
  • Associativity: inherited from ⊕ on B⁵ ✓
  • Identity: 00000 ✓
  • Inverses: each codeword is its own inverse (diagonal is 00000) ✓
  • Commutative: table symmetric ✓

Minimum non-zero weight = min(3, 3, 4) = 3 → detects 2 errors, corrects 1.

4. Parity-Check Matrix Codes

Let H be an n × r matrix over B (with n = m + r) whose last r rows form the identity Iᵣ. Define the encoding e : Bᵐ → Bⁿ by e(b) = b₁ b₂ … bₘ x₁ … xᵣ, where xⱼ = b₁h₁ⱼ ⊕ b₂h₂ⱼ ⊕ … ⊕ bₘhₘⱼ.

Then e is always a group code, and a word y is a codeword iff its syndrome y·H = 0.

Solved 5. m = 2, n = 5, H has rows 110, 011, 100, 010, 001 (the top two rows 110 and 011 generate the check bits).

  • e(00) = 00 000 = 00000
  • e(01) = 01 ⊕ row₂ = 01 011 = 01011
  • e(10) = 10 ⊕ row₁ = 10 110 = 10110
  • e(11) = 11 ⊕ (110 ⊕ 011) = 11 101 = 11101

Weights 3, 3, 4 → minimum distance 3 → corrects single errors.

Syndrome decoding with a parity-check matrixSyndrome decoding with a parity-check matrix

Decoding by syndrome. Received y = 10100. y·H = row₁ ⊕ row₃ = 110 ⊕ 100 = 010 ≠ 0, so there is an error. 010 equals row 4 of H, so bit 4 is wrong. Flip it: 10110 → decoded message 10.

5. Coset Decoding (Maximum-Likelihood)

The cosets of the group code C in Bⁿ partition Bⁿ (Lagrange!). In each coset choose a coset leader of minimum weight. A received word y is decoded as y ⊕ (leader of y's coset) - the nearest codeword. Words in the same coset have the same syndrome, so a syndrome → leader lookup table makes decoding fast.

🎯 END-TERM EXAM PREP

📝 IPU End-Term Exam Corner (5-10 Marks)

  • Q1. Define Hamming distance, weight and minimum distance. State the conditions for detecting and correcting k errors. (5 Marks)
  • Q2. For the (2, 4) code e(00) = 0000, e(10) = 0110, e(01) = 1011, e(11) = 1100, find the minimum distance and the number of errors detected/corrected. (5 Marks) → 2; detects 1, corrects 0.
  • Q3. Show that e(00) = 00000, e(01) = 01110, e(10) = 10101, e(11) = 11011 is a group code. (5 Marks)
  • Q4. Given a parity-check matrix H, find the group code it generates and decode a received word. (10 Marks)