Real World Maths Busters

The Maths Behind Everyday Life

The story, the formula and a worked example — see exactly where this maths shows up in the world around you.

Back to all stories
Technology 3 min read

Bits That Fix Themselves

Hamming codes detect and correct single-bit errors automatically.

In noisy channels, bits can flip. Hamming codes add parity bits at positions that are powers of 2, allowing the receiver to pinpoint and fix exactly one flipped bit.

Parity Bit Positions

For k data bits, you need r parity bits where 2ʳ ≥ k + r + 1. For 4 data bits: 2³ = 8 ≥ 4 + 3 + 1 = 8 ✓ — so 3 parity bits are needed, making a 7-bit codeword.

2r≥k+r+12^r \geq k + r + 1

r = parity bits, k = data bits

Encoding 4 data bits

  1. 1

    Need r where

    2r≥4+r+12^r \geq 4 + r + 1
  2. 2

    Try r=3

    23=8≥4+3+1=8  ✓2^3 = 8 \geq 4 + 3 + 1 = 8 \; \checkmark
Answer

3 parity bits turn 4 data bits into a 7-bit Hamming code that self-corrects single errors

The takeaway

Hamming codes are the elegant maths behind error-free digital communication — catching and fixing mistakes on the fly.

Back to all stories