Overview
Coding theory asks how much information can be sent reliably through a noisy channel and how to do it. It has two halves that were born almost together. Shannon showed that every channel has a capacity: below it, the error probability can be made as small as desired by coding over long blocks; above it, it cannot. Hamming began the search for explicit codes with guaranteed error-correcting power. Shannon's theorem says good codes exist without exhibiting one, and the constructive half of the subject is the effort to approach his limit with codes that can actually be encoded and decoded.
This page covers the framework: channel models, capacity, what an optimal decoder does, and why decoding is hard in general. The codes themselves, their parameters, families and bounds, are on the page Classical Error-Correcting Codes, which this page relies on rather than repeats.
Intuition
A noisy channel does not destroy information so much as blur it: each input could have produced many outputs. If the sender restricts itself to a small set of inputs, the codewords, whose clouds of likely outputs do not overlap, the receiver can tell which was sent. Capacity measures how many such non-overlapping clouds fit, per channel use, when blocks are long.
Long blocks matter because of the law of large numbers. On a channel that flips each bit with probability , a block of bits suffers close to flips with high probability; the noise becomes predictable in amount though not in position. A code needs to cope only with these typical noise patterns, of which there are about , and clouds of that size fit in the space of all -bit words. That count is the capacity of the channel, and the same count reappears for quantum channels with Pauli noise as the hashing bound.
The practical difficulty is the decoder. Finding the most likely codeword among exponentially many is easy to state and, for unstructured codes, intractable. The history of the subject is largely the history of code structures that make this search efficient.
Prerequisites
Elementary probability, including tail bounds for sums of independent variables, and the entropy and mutual information of classical information theory. Linear codes, parity-check matrices and syndromes are defined on the classical codes page.
Mathematical Definitions
A discrete memoryless channel is given by finite input and output alphabets and transition probabilities ; on a block it acts independently on each symbol. Two channels serve as the standard test cases.
Let . The binary symmetric channel has input and output alphabet and transition probabilities
Used times it acts independently on each symbol (it is memoryless): for ,
where is the Hamming distance. Equivalently with an error vector whose coordinates are independent and equal to 1 with probability , independently of . The parameter is the crossover probability; the case makes the output independent of the input, and a channel with is turned into one with crossover probability by complementing the output.
Let . The binary erasure channel has input alphabet , output alphabet and transition probabilities
Used times it acts independently on each symbol: each position is erased with probability , independently of the others and of the input, and unerased positions are received without error.
The defining feature is that the locations of the damage are known. For a linear code with parity-check matrix , decoding then amounts to solving the linear system for the erased coordinates of , which has a unique solution exactly when the erased set contains the support of no nonzero codeword. A decoder for this channel never outputs a wrong codeword; it either succeeds or reports that the solution is not unique.
The first models errors at unknown positions, the second losses at known positions. Their quantum relatives are the bit-flip and depolarizing channels on one side and the erasure channel on the other; see biased noise and erasure.
Let be a code of length used on a channel with transition probabilities . A decoder is a map from received words to codewords, possibly with an extra output "failure". Its block error probability for a transmitted codeword is the probability that the output differs from .
- A maximum-likelihood (ML) decoder outputs, for each , a codeword maximising over , ties broken by a fixed rule.
- A maximum a posteriori (MAP) decoder maximises for a given prior on codewords. It minimises the average block error probability, and it coincides with the ML decoder when the codewords are equally likely.
- A minimum-distance decoder outputs a codeword nearest to in Hamming distance.
- A bounded-distance decoder of radius outputs the codeword within distance of if there is one and fails otherwise; for that codeword is unique.
For a linear code with parity-check matrix , a syndrome decoder fixes for every syndrome one error with and outputs . When each has minimum weight in its coset it is called a coset leader, and the decoder is a minimum-distance decoder.
These rules are about which codeword to output; they say nothing about how to compute it. On the binary symmetric channel with crossover probability below one half, the ML, minimum-distance and coset-leader syndrome decoders coincide up to the breaking of ties; see the theorem on syndrome decoding.
Theorems
Let be a discrete memoryless channel with input alphabet and output alphabet . Define its capacity
the maximum over input distributions of the mutual information, in bits, between the input and the output distributed according to .
A code of length and rate is a set of codewords in together with a decoder .
- Achievability. For every and every there is, for all sufficiently large , a code of length and rate whose probability of decoding error is at most for every transmitted codeword.
- Converse. If , there is a constant such that every code of rate , of any length, has average probability of decoding error at least when the codewords are used with equal probability.
The theorem is due to Shannon, whose argument for achievability chooses the codewords at random; a complete proof of both parts, by joint typicality and Fano's inequality, is in chapter 7 of Cover and Thomas. No proof is recorded here. The special case of the erasure channel, with linear codes, is proved in full in a separate record.
The theorem is an existence statement. It does not say how to find the codes, and the random codes in its proof have no efficient decoder.
- A discrete memoryless channel, that is, finite input and output alphabets and independent, identical action on each transmitted symbol.
- No feedback; the encoder and decoder may use arbitrarily long blocks and unlimited computation.
- The converse stated here is the weak converse (error probability bounded away from zero).
For the two standard channels the capacity has a closed form.
For the binary symmetric channel, , because given the output is flipped with probability . The entropy is at most 1 bit, with equality for a uniform input, which gives the formula; by the noisy-channel coding theorem this maximum of the mutual information is the capacity. The value appears as an example in Shannon's paper.
The capacity is 1 at , falls to 0 at and is symmetric under . Numerically , so a channel that flips 11% of the bits still supports rates up to about one half.
- Memoryless binary symmetric channel with crossover probability ; .
- Capacity in bits per channel use, in the sense of the noisy-channel coding theorem.
For the binary erasure channel with input distribution , the output reveals with probability and nothing otherwise, so , maximised at . A derivation is in Cover and Thomas.
The capacity equals the expected fraction of unerased symbols. This is what a sender could achieve trivially if told in advance which positions would be erased; the content of the theorem is that the same rate is achievable without that knowledge. Random linear codes achieve it, with a short proof.
- Memoryless binary erasure channel with erasure probability .
- Capacity in bits per channel use, in the sense of the noisy-channel coding theorem.
The general theorem is proved in the cited textbook and not here. The erasure channel is the one case where the achievability half has a short and fully elementary proof, and it shows two further things: linear codes suffice, and the random-coding argument is nothing more than a rank computation.
Let and , and put . For every and every integer with
there is a binary linear code of length and dimension such that, on the binary erasure channel , the transmitted codeword is the unique codeword consistent with the received symbols except with probability at most , for every transmitted codeword.
In particular, taking , rates arbitrarily close to the capacity are achieved by linear codes with failure probability tending to zero exponentially fast in , and decoding takes operations by Gaussian elimination.
- Memoryless binary erasure channel with erasure probability .
- Decoding is by solving the linear system for the erased positions (which is maximum-likelihood for this channel); no bound on decoding time is claimed beyond that of Gaussian elimination.
- Only achievability is asserted. That no rate above is achievable is the converse part of the general theorem.
Proof · Proof that random linear codes achieve the erasure-channel capacity
Setting. Let be a binary matrix and encode a message as . The channel erases a random set , each position independently with probability . Write for the submatrix of columns outside . The receiver knows and the vector . A message is consistent with what was received if and only if . Decoding therefore fails, in the sense that is not the unique consistent message, exactly when
This event depends on and but not on . Call its probability over .
Random matrix, fixed erasure set. Let the entries of be independent uniform bits and fix with unerased positions. For a fixed the vector is uniformly distributed on : choose with ; conditioned on the other rows, row of is uniform and shifts the sum to a uniform vector. Hence , and by the union bound over the nonzero ,
Few erasures are likely. Let be the event . The number of erasures is a sum of independent indicator variables of mean , so by Hoeffding's inequality . On we have and, since and ,
Averaging. Combining the two estimates, with and independent,
So at least one matrix has .
The code has dimension . If had rank less than there would be with , and decoding would fail for every , giving . Hence has rank , its row space is a linear code of dimension , messages correspond bijectively to codewords, and for every transmitted codeword the probability that it is not the unique codeword consistent with the received symbols is at most .
Decoding. The consistent messages are the solutions of the linear system , found by Gaussian elimination in operations.
On the decoding side, the link between the probabilistic notion of an optimal decoder and the algebraic notion of a syndrome is the following.
Let be a binary linear code of dimension with parity-check matrix , used on the binary symmetric channel with , and let be the received word.
- A codeword maximises the likelihood if and only if it minimises the Hamming distance .
- Let have minimum weight among all with . Then is a maximum-likelihood decision.
- Fix one such minimum-weight error for each syndrome , of weight . The resulting decoder is correct exactly when the channel error equals for some , so its block error probability is the same for every transmitted codeword and equals
the sum running over all syndromes.
- is a binary linear code of dimension with parity-check matrix .
- The channel is with .
Proof · Proof that coset-leader decoding is maximum-likelihood on the binary symmetric channel
1. For the binary symmetric channel,
Since , the ratio lies strictly between 0 and 1, so the likelihood is a strictly decreasing function of . Maximising one is minimising the other.
2. The map is a bijection from onto the coset , and because and the solution set of this linear system is a coset of . Under the bijection . A codeword nearest to therefore corresponds to an element of least weight in the coset, and conversely is a codeword nearest to . By item 1 it is a maximum-likelihood decision.
3. Let be transmitted and the channel error, so and the syndrome is . The decoder outputs , which equals if and only if . The distribution of does not depend on , and . The events for different are disjoint, so the probability of correct decoding is , whatever codeword was sent.
Finally, the obstruction to doing this efficiently.
The following decision problems are NP-complete.
- Syndrome decoding (coset weights). Input: a binary matrix , a vector and an integer . Question: is there a vector of Hamming weight at most with ?
- Minimum distance. Input: a binary matrix and an integer . Question: is there a nonzero vector of Hamming weight at most with ?
Problem 1 was shown NP-complete by Berlekamp, McEliece and van Tilborg, who also proved NP-completeness of deciding whether a code has a codeword of weight exactly . Problem 2, which they left open, was settled by Vardy. The proofs are reductions from known NP-complete problems and are not reproduced here.
Consequently, unless , there is no polynomial-time algorithm that performs minimum-distance decoding for every linear code, and none that computes the minimum distance of every linear code.
The statement is about arbitrary codes in the worst case. It does not prevent specific families from having fast decoders, and it does not by itself say that decoding a random code is hard, which is the stronger assumption underlying code-based cryptography.
- Worst-case complexity over all binary matrices ; the input is the matrix itself, with no promise of structure.
- The statements concern decision problems; the corresponding search problems are at least as hard.
Worked Examples
Capacity and three simple schemes at p = 0.1
On the capacity is bits per use.
Uncoded. Sending 4 bits raw, at rate 1, the block arrives intact with probability , so the block error probability is .
Repetition code , majority vote. Decoding fails when two or three bits flip: per encoded bit, at rate .
Hamming code , syndrome decoding. The coset leaders are the zero vector and the seven vectors of weight 1, so by the theorem on syndrome decoding
for a block of 4 message bits, at rate . That rate is above capacity, and the code is not rescued by its structure: by the converse, no code of rate can have small error on this channel. At , where the capacity is , the same code gives against uncoded. A single short code is good only for sufficiently weak noise; Shannon's theorem is about what happens as the block length grows at fixed rate.
Coset leaders and ties
Let , a code with parity checks and . The four cosets and their minimum-weight elements are:
- syndrome : the code itself, leader ;
- syndrome : , leader ;
- syndrome : , leader ;
- syndrome : , two candidates, and .
A flip of bit 2 and a flip of bit 4 are indistinguishable, as they must be for a code of distance 2: their sum is a codeword. Whichever leader is chosen, the decoder is maximum-likelihood, and . Maximum-likelihood decoding is not the same as correcting all errors up to some weight; it is the best that can be done with the cosets the code provides.
Erasures: where the rank argument bites
Take a random linear code with , on . About 700 positions survive. Decoding fails only if the matrix of surviving columns of the generator matrix has rank below 500, and the union bound in the proof gives probability at most for exactly 700 survivors. Failure becomes likely only when fewer than about 500 positions survive, that is, when the erased fraction approaches ; the capacity is exactly the statement that must stay below the surviving fraction.
Applications
- Quantum error correction. A stabilizer code turns the decoding of Pauli errors into syndrome decoding of a classical code over a four-letter alphabet, with one change: errors that differ by a stabilizer are equivalent, so the optimal decoder maximises the total probability of a class of errors rather than of a single error. See stabilizer codes and quantum decoders.
- Quantum capacities. The quantum analogues of the coding theorem are the subject of quantum Shannon theory.
- Erasure conversion. The factor of two between correctable erasures and correctable errors is the reason hardware that flags its own faults is valuable; see biased noise and erasure.
Computational Complexity
Encoding a linear code costs bit operations. Maximum-likelihood decoding by table lookup needs a table of coset leaders, and by exhaustive search a pass over codewords; both are exponential in at fixed rate. By the hardness theorem above no method is polynomial for all linear codes unless , and computing the minimum distance is equally hard. On the erasure channel, by contrast, maximum-likelihood decoding of any linear code is Gaussian elimination, .
Structured families escape the hardness result: bounded-distance decoding of Reed–Solomon and BCH codes is polynomial (Huffman and Pless), and iterative decoding of LDPC codes takes time linear in per iteration (Gallager, Richardson and Urbanke), though it is not maximum-likelihood.
Limitations and Common Pitfalls
- Capacity is asymptotic. The theorem promises small error for long enough blocks. At a fixed finite length the best achievable rate is below capacity, and how far below is a separate, finer question.
- Existence is not construction. The random codes of the achievability proof have no efficient decoder. A scheme "achieves capacity" in a practically meaningful sense only if encoding and decoding are efficient as well.
- Block error and bit error are different quantities. The numbers in the examples are block error probabilities. A decoder optimal for one criterion need not be optimal for the other.
- Minimum distance does not determine performance on a random channel. It controls the worst case. Two codes with the same can have different error probabilities, which depend on the whole set of coset leaders.
- Maximum-likelihood needs the right likelihood. Nearest-codeword decoding is maximum-likelihood on the binary symmetric channel with . For asymmetric noise, noise with memory, or soft outputs, the most likely codeword is generally not the nearest one in Hamming distance.
- Worst-case hardness is not average-case hardness. NP-completeness of syndrome decoding concerns the hardest instances over all codes; it does not by itself imply that typical instances are hard, nor that any particular family is.