Coding Theory — Definition, Formula & Example
Coding theory is the study of how to add carefully chosen extra symbols to a message so that a receiver can detect, and often fix, errors caused by noise. It is also called the study of error-correcting codes.
A block code of length over an alphabet with symbols is a subset . Its elements are called codewords. The Hamming distance counts the positions where two words and differ. The minimum distance of is . Coding theory studies how the length , the size , and the minimum distance trade off against each other. Results such as the Hamming and Singleton bounds limit these trade-offs. The field also builds efficient encoding and decoding algorithms, often using linear codes, which are subspaces of .
Key Formula
Where:
- = Number of symbol errors per codeword the code is guaranteed to correct
- = Minimum Hamming distance between any two distinct codewords
- = Floor function: round down to the nearest integer
Worked Example
Problem: A binary code has four codewords: , , , and . Find its minimum distance and the number of errors it can correct. Then decode the received word using nearest-codeword decoding.
Step 1: Compute the Hamming distance for all 6 pairs of codewords by counting the positions that differ.
Step 2: The smallest distance is 3, so . Apply the formula.
Step 3: Compare the received word to each codeword. Choose the codeword at the smallest distance.
Answer: The minimum distance is 3, so the code corrects any single error. The received word decodes to , because a single flipped bit in position 2 explains the received word.
Why It Matters
Reed–Solomon codes let a QR code scan even when part of it is torn. They also let deep-space probes send clear images across billions of miles. You meet coding theory in undergraduate abstract algebra and discrete math courses, and engineers use it to design 5G wireless links, solid-state drives, and error-correcting computer memory.
Common Mistakes
Mistake: Treating coding theory and cryptography as the same subject.
Correction: Cryptography hides a message from eavesdroppers. Coding theory protects a message from accidental noise. Error-correcting codes add public, structured redundancy, and they offer no secrecy at all.
