Skip to main content

Linear block coding with example

Short answer

Linear block codes add parity bits using modulo-2 equations. A (6,3) code with G=[I|P] encodes m=101 to 101101. At receiver, syndrome s = rH^T detects errors; if s matches a column of H, that bit is flipped. Example: syndrome (110) identifies bit 3 error, correcting it.

Describe linear block coding method with a suitable example for detection of an error.

A linear block code (n, k) maps each k-bit message to an n-bit codeword by adding n − k parity bits using linear (modulo-2) equations, so the sum of any two codewords is also a codeword. Codeword c = m·G, where G is the k × n generator matrix.

Example: (6,3) code

      | 1 0 0 : 0 1 1 |           | 0 1 1 : 1 0 0 |
 G =  | 0 1 0 : 1 0 1 |      H =  | 1 0 1 : 0 1 0 |
      | 0 0 1 : 1 1 0 |           | 1 1 0 : 0 0 1 |

Here G = [I | P] and the parity-check matrix H = [Pᵀ | I]. Codewords satisfy c·Hᵀ = 0.

Encoding

Message m = 101 → c = row 1 ⊕ row 3 = 100011 ⊕ 001110 = 101101.

Error detection using the syndrome

Receiver computes syndrome s = r·Hᵀ (mod 2).

  • s = 000 means no error (accept).
  • s ≠ 000 means an error; if s equals column j of H, then bit j is in error (single error).

Suppose bit 3 is received in error: r = 100101 (sent 101101).

  • s1 = row 1 (011100): r2⊕r3⊕r4 = 0⊕0⊕1 = 1
  • s2 = row 2 (101010): r1⊕r3⊕r5 = 1⊕0⊕0 = 1
  • s3 = row 3 (110001): r1⊕r2⊕r6 = 1⊕0⊕1 = 0

s = (1 1 0) ≠ 0, so an error is detected. It equals column 3 of H, so bit 3 is wrong: flip it to get 101101, and message = 101.

Minimum distance of this code is 3: it detects up to 2 errors and corrects 1 error.

✓ Answer checked by Claude Sonnet 5.5

All Data Communication chapter 8 questions →