Shannon's Noisy Channel Coding Theorem: Achievability via Random Coding
Anchor (Master): Cover & Thomas 2006 Elements of Information Theory 2e (Wiley) §7.4-7.7; Csiszar & Korner 2011 Information Theory: Coding Theorems for Discrete Memoryless Systems 2e (Cambridge) §2.1-2.3; Shannon 1948 A Mathematical Theory of Communication section 13 (the original random coding argument)
Intuition Beginner
You have a noisy channel. You want to send messages reliably. How fast can you go? Shannon answered this in 1948: the maximum reliable rate is the channel capacity , a single number determined entirely by the channel's noise statistics. Any rate below is achievable. Any rate above is not.
The surprise is that the capacity is nonzero at all. A channel that flips 10% of your bits seems like it should corrupt any message beyond recovery. But if you use the channel many times and encode cleverly, the errors average out. You can push through almost bits of information per use, with errors that vanish as you use the channel more and more.
How do you prove such a thing exists? Shannon's trick was random coding. Instead of designing one clever code, imagine picking codewords at random from a giant hat. Each codeword is a sequence of symbols drawn independently from a fixed distribution. You pick such codewords, each of length , for a rate of bits per channel use.
Then you transmit one codeword through the noisy channel. The receiver gets a corrupted version. To decode, the receiver looks for the codeword that is "jointly typical" with the received sequence — meaning the pair looks like it was generated by the joint input-output distribution of the channel. If the rate is below capacity, there is almost surely only one such codeword, and the decoder recovers the message.
The argument works on average over the random codebook. Most random codebooks are good. The probability that a randomly chosen codebook causes a decoding error goes to zero as the block length grows. Therefore, at least one good codebook exists. You do not know which one, but existence is enough.
Visual Beginner
| Parameter | Meaning |
|---|---|
| Block length (number of channel uses per codeword) | |
| Rate in bits per channel use | |
| Number of codewords in the codebook | |
| Channel capacity | |
| Probability of decoding error |
Figure: A diagram showing a codebook as a tall rectangular array. Each row is a codeword of length . There are rows. An arrow from row goes into a "channel" box, which corrupts some symbols, producing a received word . A decoder box compares to all codewords and outputs the index of the one that is jointly typical. Below the diagram, a graph shows versus : for , the error curve drops exponentially toward zero as increases; for , the error stays bounded away from zero.
Worked example Beginner
Consider a binary symmetric channel (BSC) with crossover probability . Its capacity is , where is the binary entropy function.
First compute . This is . Working it out: bits. So bits per channel use.
The theorem says: for any rate , you can find codes that achieve error probability as small as you like, provided you use the channel enough times. Let us check , which is safely below capacity.
With and block length , you have codewords. That is about codewords — far too many to write down, but the random coding argument says they exist. Each codeword has 100 bits. The channel flips about 10 of them.
The decoder receives a 100-bit sequence with roughly 10 errors. It checks which codeword is jointly typical with the received sequence. A jointly typical pair satisfies two conditions: is typical for the input distribution, is typical for the output distribution, and the pair is typical for the joint distribution. For , there are few enough codewords that the wrong ones are unlikely to be jointly typical with the received word. The error probability vanishes as grows.
Check your understanding Beginner
Formal definition Intermediate+
Let be a discrete memoryless channel with input alphabet and output alphabet . Let be the channel capacity, and let denote a capacity-achieving input distribution.
Definition (Codebook). An code for the channel consists of:
- An index set (the message set).
- An encoding function mapping each message to a codeword .
- A decoding function mapping each received sequence to a message estimate.
The rate of the code is bits per channel use.
Definition (Probability of error). The maximal probability of error for the code is:
Definition (Achievable rate). A rate is achievable if there exists a sequence of codes with as .
Definition (Channel capacity). The channel capacity is the supremum of all achievable rates:
Counterexamples to common slips
The theorem does not say the error is zero. It says the error probability goes to zero as the block length increases. For any finite , the error is positive. The asymptotic statement is that you can make the error as small as you like by using a long enough code.
Achievability and converse are two separate proofs. The achievability part shows implies reliable codes exist. The converse shows implies reliable codes do not exist. Together they pin down as the sharp threshold.
Random coding does not produce a usable code. The random coding argument shows existence. It does not give you a specific codebook or a practical decoder. The gap between existence and construction is where coding theory lives.
Key theorem with proof Intermediate+
Theorem (Shannon's noisy channel coding theorem — achievability). For a discrete memoryless channel with capacity , every rate is achievable. That is, for any , there exists a sequence of codes with as .
Proof. The proof has four steps: random codebook generation, joint typicality decoding, error analysis, and the existence argument.
Step 1: Random codebook generation. Fix a rate . Fix the capacity-achieving input distribution . Generate a codebook with codewords by drawing each codeword independently: for each message , the codeword is drawn i.i.d. from . The codewords are independent of each other.
Step 2: Joint typicality decoder. After receiving , the decoder declares message if there is a unique such that is jointly -typical with respect to the joint distribution . If no such exists or more than one exists, the decoder declares an error.
Recall from 46.02.01 that is jointly -typical if:
Step 3: Error analysis. Let be uniform on and independent of the codebook. By symmetry of the random coding construction, the average error probability is the same for all messages, so:
An error occurs if either the transmitted codeword is not jointly typical with the received sequence (event ), or some other codeword is jointly typical with the received sequence (event for wrong codeword ).
By the joint AEP, as .
For the wrong codewords: codeword for is generated independently of (which depends only on ). By the joint AEP, the probability that is jointly typical with is at most . By the union bound:
Since at the capacity-achieving distribution, we can choose small enough that . Then the union bound probability vanishes exponentially in .
Step 4: Existence. The average error probability over the random codebook vanishes. Therefore, there exists at least one codebook for which the error probability is at most the average. This codebook gives an code with .
Bridge. The achievability proof builds toward the converse in 46.03.03, where Fano's inequality shows that rates above cannot be achieved, completing the full coding theorem. The joint typicality decoder appears again in rate-distortion theory 46.04.01 as the same typicality test used to match source sequences to reproduction codewords. The foundational reason random coding works is that independently generated codewords spread out in the output space so that the probability of two codewords landing in the same typicality region is exponentially small — this is exactly the packing interpretation of capacity. The random coding exponent governing the speed of convergence generalises to the reliability function of the channel. Putting these together, the achievability proof reveals that capacity is not merely an upper bound but a sharp threshold: the boundary between the achievable and the impossible.
Exercises Intermediate+
Lean formalization Intermediate+
Mathlib has the PMF type for discrete distributions and basic measure-theoretic machinery, but it does not define a channel coding problem. There is no codebook type (a finite collection of codewords), no encoding/decoding function, no probability of error computation, no joint typicality set, and no achievability theorem. The random codebook generation requires product distributions on , which Mathlib can express via PMF.bind and Fin vectors, but the typicality condition and its convergence properties are absent. A Codex.InformationTheory.ChannelCoding module would need to define codebooks, decoding functions, error probabilities, and prove the achievability bound via the joint AEP and the union bound. This unit ships without formalization.
Advanced results Master
The random coding exponent
The achievability proof shows that for , but it does not specify the speed. Gallager (1965) sharpened the analysis to show that the error probability decays exponentially:
where the random coding exponent (or Gallager exponent) is:
with
The function is positive for , zero at , and decreasing in . It gives a quantitative bound on how fast the error decays as a function of the gap and the channel structure. For the BSC with and , the exponent is approximately , giving . At , this is about .
The method of types achievability
An alternative proof of achievability uses the method of types rather than joint typicality. A type (or empirical distribution) of a sequence is the distribution that assigns frequency to symbol . The type class is the set of all sequences with empirical distribution .
The key properties are: (1) the number of types is polynomial in (at most ), (2) each type class has size , and (3) the probability of a type class under distribution is .
For the achievability proof, the encoder sends codewords drawn uniformly from type classes close to the capacity-achieving type . The decoder finds the unique codeword whose joint type with the received sequence is close to the joint distribution . The error analysis counts the number of type classes that could cause confusion and bounds the probability using the divergence between the true joint type and the confounding type. This gives a stronger bound on the pre-factor (polynomial instead of exponential in ) at the cost of a slightly more involved counting argument.
Strong converse and the strong coding theorem
The standard achievability proof shows that rates below are achievable with error probability tending to zero. The strong converse (Wolfowitz, 1957) shows something stronger: for rates above , the error probability tends to 1 (not merely stays bounded away from zero). Together:
Theorem (Strong converse). For any sequence of codes with :
The strong converse is proved using the strong typicality version of the joint AEP and a refinement of Fano's inequality. The key insight is that when , there are more codewords than the typicality regions can accommodate, and most codewords collide, forcing the decoder into errors with overwhelming probability.
The reliability function
The random coding exponent is a lower bound on the best achievable error exponent. The reliability function is the best achievable exponent:
where is the minimum error probability over all codes. The reliability function satisfies , where is the sphere-packing exponent (the best known upper bound on ). For close to , , so the reliability function is known exactly near capacity. For low rates, a gap between and persists, and the exact reliability function is one of the major open problems in information theory.
Synthesis. Shannon's achievability proof is the foundational result that gives capacity its operational meaning: the maximum is the sharp threshold between reliable and unreliable communication. The random coding argument is the central insight — generating codewords independently from the capacity-achieving distribution ensures that wrong codewords are exponentially unlikely to masquerade as the transmitted one, and this is exactly the packing interpretation of the typicality regions. The Gallager exponent refines this to a quantitative bound on the error decay, building toward the reliability function which remains partially open. The method of types provides an alternative achievability route that appears again in the strong converse and in rate-distortion theory. The achievability proof generalises to continuous channels (AWGN), to channels with memory, and to multiuser settings, putting these together into the information-theoretic framework that underpins all of modern communications.
Full proof set Master
Proposition (Size of the jointly typical set). Let be the jointly -typical set for the distribution . Then:
Proof. By definition, for any :
Since is a probability distribution:
Rearranging: .
Proposition (Probability that a wrong codeword is jointly typical). Let be drawn from independently of (which was generated by transmitting through the channel). Then for sufficiently large:
Proof. The joint distribution of factors as when conditioned on , but since is independent of the transmitted codeword, the pair has the product distribution (not the joint distribution ).
For :
On the typical set, is within of (since , and each term is within of its entropy). Therefore:
The probability under the product measure is:
Using the size bound :
Connections Master
46.03.01— Channel capacity is defined there; this unit gives it operational meaning via the coding theorem.46.02.01— The AEP and joint typicality are the analytical tools that make the random coding proof work; the typicality conditions control both the size of the search space and the probability of confusion.46.03.03— The converse of the coding theorem (Fano's inequality) complements this achievability result to give the full theorem.46.04.01— Rate-distortion theory has an analogous achievability proof using random codebooks in the source-coding setting.46.08.01— LDPC codes are explicit constructions that approach the Shannon limit; the random coding argument shows the limit exists but leaves construction as a separate problem.46.04.02— Chernoff information governs error exponents in hypothesis testing; the Gallager exponent is the analogous quantity for channel coding.
Historical & philosophical context Master
Claude Shannon proved the noisy channel coding theorem in Part III of his 1948 paper "A Mathematical Theory of Communication" (Bell System Technical Journal 27, 379-423 and 623-656). The achievability proof used a random coding argument that was entirely novel. Shannon generated codewords at random and showed that the average error probability over all possible codes vanishes for rates below capacity, establishing the existence of good codes without constructing any specific one.
The random coding argument was controversial when first presented. Many mathematicians and engineers found it unsatisfying that the proof shows existence without construction. John von Neumann reportedly defended Shannon's approach, pointing out that probabilistic existence proofs are standard in mathematics. The argument is analogous to the probabilistic method in combinatorics (Erdos, 1947): showing that a random structure has a desired property with positive probability proves that such a structure exists.
Robert Gallager refined Shannon's error analysis in his 1965 paper "Simple Derivation of the Coding Theorem and Some Applications" (IEEE Transactions on Information Theory 11, 3-18). Gallager introduced the random coding exponent and showed that the error probability decays as , giving a quantitative handle on the speed of convergence. Gallager's bound was the foundation for the reliability function analysis developed by the Soviet school (Pinsker, Dobrushin) and by Csiszar and Korner.
The strong converse was proved by Jacob Wolfowitz in 1957 in "The Coding of Messages Subject to Chance Errors" (Illinois Journal of Mathematics 1, 591-606). The strong converse upgraded the converse from "rates above have bounded error" to "rates above have error tending to 1," making the coding theorem a sharp threshold.
The gap between existence and construction defined coding theory for the next seven decades. Shannon's proof showed that good codes exist but provided no guidance on how to find them. Constructing explicit codes that approach capacity required the development of algebraic coding theory (Hamming, Reed-Solomon, BCH codes in the 1950s-1960s), concatenated codes (Forney, 1966), and finally iterative decoding (LDPC and turbo codes in the 1990s-2000s). Each of these constructions is an attempt to close the gap between Shannon's existence proof and practical engineering.
Bibliography Master
@article{shannon1948,
author = {Shannon, C. E.},
title = {A Mathematical Theory of Communication},
journal = {Bell System Technical Journal},
volume = {27},
pages = {379--423 and 623--656},
year = {1948},
}
@book{cover-thomas2006,
author = {Cover, T. M. and Thomas, J. A.},
title = {Elements of Information Theory},
edition = {2nd},
publisher = {Wiley},
year = {2006},
}
@book{csiszar-korner2011,
author = {Csisz{\'a}r, I. and K{\"o}rner, J.},
title = {Information Theory: Coding Theorems for Discrete Memoryless Systems},
edition = {2nd},
publisher = {Cambridge University Press},
year = {2011},
}
@article{gallager1965,
author = {Gallager, R. G.},
title = {Simple Derivation of the Coding Theorem and Some Applications},
journal = {IEEE Transactions on Information Theory},
volume = {11},
pages = {3--18},
year = {1965},
}
@article{wolfowitz1957,
author = {Wolfowitz, J.},
title = {The Coding of Messages Subject to Chance Errors},
journal = {Illinois Journal of Mathematics},
volume = {1},
pages = {591--606},
year = {1957},
}
@book{gallager1968,
author = {Gallager, R. G.},
title = {Information Theory and Reliable Communication},
publisher = {Wiley},
year = {1968},
}