Paper
Part IErrors, Information and Channels

Capacity and Shannon's Theorem

November 14, 202654 min readbeginner

Capacity is the largest rate a channel carries with vanishing error. The chapter derives it for the binary symmetric, erasure and Gaussian channels, reaches the −1.59 dB limit and proves Shannon's theorem both ways.

The previous chapter, Compression in Practice, ended on a comparison. A binary source that emits a 1 with probability 0.1 compresses to h(0.1)=0.4690h(0.1) = 0.4690 bits per letter, and a binary symmetric channel that flips each bit with probability 0.1 was said to carry 1−h(0.1)=0.53101 - h(0.1) = 0.5310 bits per use with an error probability as small as desired. Since 0.4690<0.53100.4690 < 0.5310, the source can cross that channel at one use per letter. The first number was earned in Source Coding and Prefix Codes, and this chapter earns the second.

Two earlier chapters supply the tools. Channels, Signals and Likelihoods built the binary symmetric channel BSC(p)\text{BSC}(p), the binary erasure channel BEC(ε)\text{BEC}(\varepsilon) and the Z-channel Z(p)\text{Z}(p) in Three Discrete Channels, and the Gaussian channel in The Gaussian Channel and BPSK. Information and Entropy supplied the mutual information I(X;Y)=H(Y)−H(Y∣X)I(X;Y) = H(Y) - H(Y \mid X), the number of bits one channel use conveys about its input, and its section Mutual Information of the Binary Symmetric Channel showed that a uniform input conveys the most over that channel.

The chapter counts noise patterns to see where 1−h(p)1 - h(p) comes from, computes capacity for the binary symmetric, erasure and Gaussian channels, and follows the trade of bandwidth against power to the Shannon limit of −1.59-1.59 dB. Typical sequences, random coding and Fano's inequality then prove the theorem in both directions.

Every number in the chapter is recomputed by ch07_capacity_and_shannons_theorem.py in the python/ folder of the companion repository ecc-book-lab, and the charts are drawn by ch07_charts.py in the same folder.

01.Counting Noise Patterns

Send a block of n=1000n = 1000 bits through BSC(0.1)\text{BSC}(0.1). Each bit flips independently with probability 0.1, so about 100 bits flip, as the binomial count of Counting Errors with the Binomial Distribution predicts, but which 100 is unknown. There are (1000100)\binom{1000}{100} ways to choose them, whose base-2 logarithm is 464.42, and a receiver that undoes the noise must in effect learn which of these patterns occurred. Table 1 repeats the count for three block lengths.

Table 1. The number of noise patterns of weight for , against

nnlog⁡2(nn/10)\log_2 \binom{n}{n/10}Per symboln h(0.1)n\,h(0.1)Shortfall
10043.980.439846.902.92
1000464.420.4644469.004.57
100004683.720.46844689.966.23

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

Per symbol, the count climbs toward h(0.1)=0.4690h(0.1) = 0.4690 and never passes it. To see why, write k=pnk = pn and take the single term of the binomial expansion for that kk. Every term of the expansion is positive and the terms add to (p+(1−p))n=1(p + (1 - p))^n = 1, so

(npn)ppn(1−p)(1−p)n≤1.\binom{n}{pn} p^{pn} (1 - p)^{(1 - p)n} \le 1 .

The power of pp and 1−p1 - p is 2pnlog⁡2p+(1−p)nlog⁡2(1−p)=2−nh(p)2^{pn \log_2 p + (1 - p)n \log_2 (1 - p)} = 2^{-n h(p)}, so the inequality says (npn)≤2nh(p)\binom{n}{pn} \le 2^{n h(p)}. The shortfall grows far more slowly than nn, so per symbol it vanishes. Typical Sequences shows that the patterns the noise is likely to produce, of any weight, number about 2nh(p)2^{n h(p)} as well.

Now turn the count around. A code for this channel is a list of MM codewords, each a string of nn bits. When codeword cc is sent, the received word lies, with high probability, in a cloud of about 2nh(p)2^{n h(p)} words around cc, one for each likely noise pattern. For the receiver to name the codeword without confusion, the clouds of different codewords must not overlap, as Figure 1 draws. There are only 2n2^n binary words of length nn to share, so

M≤2n2nh(p)=2n(1−h(p)).M \le \frac{2^n}{2^{n h(p)}} = 2^{n(1 - h(p))} .
(1)

For n=1000n = 1000 and p=0.1p = 0.1 this is 21000/2469=25312^{1000}/2^{469} = 2^{531}, so at most 531 bits of message fit in 1000 uses, or 1−h(0.1)=0.53101 - h(0.1) = 0.5310 bits per use. The argument is a heuristic, since clouds could overlap a little, and Fano's Inequality and the Converse turns it into a proof. The surprise, proved in The Random Coding Argument, is that the bound can be reached.

A shaded box stands for all 2^n binary words of length n. Inside it six dots mark codewords, each surrounded by a dashed circle, its noise cloud, which holds the roughly 2^(n h(p)) received words that noise on a binary symmetric channel is likely to produce from it. The clouds do not overlap, so a received word inside a cloud points back to one codeword. Text beside the box says the number of codewords M is at most 2^n divided by 2^(n h(p)), which is 2^(n (1 minus h(p))), and that for n = 1000 and p = 0.1 this is 2^1000 over 2^469, or 2^531. all 2^n binary words of length n a codeword a received word noise cloud: the words noise is likely to make from it Clouds that do not overlap can be told apart, so the number of codewords M is at most 2^n / 2^(n h(p)) = 2^(n (1 − h(p))) For n = 1000 and p = 0.1: 2^1000 / 2^469 = 2^531
Figure 1. Noise clouds in the space of all binary words. Each codeword needs its own cloud of about likely received words, and only words exist, which caps the number of codewords at .

Figure 2 names the pieces of the argument. A message WW is one of MM equally likely values. The encoder maps it to a codeword Xn=(X1,…,Xn)X^n = (X_1, \dots, X_n), the channel is used nn times and delivers Yn=(Y1,…,Yn)Y^n = (Y_1, \dots, Y_n), and the decoder forms an estimate W^\hat W from YnY^n. The rate is

R=log⁡2Mnbits per channel use,R = \frac{\log_2 M}{n} \quad \text{bits per channel use},
(2)

and the error probability Pe=P(W^≠W)P_e = P(\hat W \ne W) is averaged over the MM messages, or replaced by its maximum over messages when the worst case matters. The source of the previous chapter, at 0.4690 bits per letter, needs only 0.4690/0.5310=0.88320.4690/0.5310 = 0.8832 uses of this channel per letter.

The coding system as a row of three boxes joined by arrows. A message W, one of M values, enters the encoder, which picks the codeword X^n of n channel inputs. X^n enters the channel, used n times without memory, which flips or blurs symbols and delivers Y^n. Y^n enters the decoder, which outputs an estimate W hat, and an error occurs when the estimate differs from W. A line underneath gives the rate R = log2(M) / n bits per channel use. encoder channel decoder W message X^n Y^n W estimate picks codeword X^n(W) one of M codewords flips or blurs symbols memoryless, n uses guesses W from Y^n error if the guess is wrong rate R = log2(M) / n bits per channel use
Figure 2. The coding system. A message chooses a codeword of symbols, the channel corrupts each symbol independently, and the decoder guesses the message from what arrives.

02.Channel Capacity

The general definition replaces the count with the mutual information of Information and Entropy.

The definition is a formula about one use of the channel, with no codes in it. Its operational counterpart is the achievable rate. A rate RR is achievable if, for every ϵ>0\epsilon > 0 and every large enough nn, some code of length nn with at least 2nR2^{nR} codewords has error probability below ϵ\epsilon. The coding theorem says the largest achievable rate is CC.

Shannon stated the theorem in 1948 [1] and treated the Gaussian channel geometrically the following year [2]. Feinstein gave an early rigorous proof of the direct half [3], and Gallager derived bounds on how fast the error falls with nn [4]. The proofs in this chapter follow the typical-sequence route of Cover and Thomas [5], specialized to the binary symmetric channel so that every step can be checked with numbers.

03.The Binary Symmetric Channel

Start with a channel whose capacity should come out close to one half, BSC(0.11)\text{BSC}(0.11), and with an input that is not uniform.

The example generalizes at once. With P(X=1)=qP(X = 1) = q, the probability of a received 1 is

r=q(1−p)+(1−q)p,r = q(1 - p) + (1 - q)p ,
(3)

and H(Y∣X)=q h(p)+(1−q) h(p)=h(p)H(Y \mid X) = q\,h(p) + (1 - q)\,h(p) = h(p), because each input meets the same flip probability. The mutual information is therefore I(X;Y)=h(r)−h(p)I(X;Y) = h(r) - h(p). Only the first term depends on the input, and the binary entropy function is at most 1, reached only at r=12r = \frac12. Setting q=12q = \frac12 gives r=12(1−p)+12p=12r = \frac12(1 - p) + \frac12 p = \frac12, so the uniform input reaches the maximum, as Information and Entropy found. Hence

For p=0.11p = 0.11, h(0.11)=0.4999h(0.11) = 0.4999 and C=0.5001C = 0.5001, and the flip probability whose capacity is exactly one half is 0.110028. For p=0.1p = 0.1 the capacity is the 0.5310 promised at the start. Table 2 lists the mutual information for several inputs, beside the same quantity for the erasure channel of the next section.

Table 2. Mutual information against the input probability for and

qqrr for BSC(0.11)\text{BSC}(0.11)h(r)h(r)I(X;Y)I(X;Y), BSC(0.11)\text{BSC}(0.11)I(X;Y)I(X;Y), BEC(0.5)\text{BEC}(0.5)
0.10.1880.69730.19740.2345
0.20.2660.83570.33580.3610
0.30.3440.92860.42870.4406
0.40.4220.98240.48250.4855
0.50.5001.00000.50010.5000

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

Both channels peak at q=12q = \frac12. Figure 3 plots each capacity against the noise parameter. The binary symmetric curve is symmetric about p=12p = \frac12, because a receiver facing a channel that flips almost every bit simply inverts what it sees, and at p=12p = \frac12 the output is independent of the input and the capacity is zero.

Capacity in bits per channel use against the channel parameter from 0 to 1. The binary symmetric channel gives 1 minus h(p), a U-shaped curve that is 1 at both ends and 0 at p = 0.5. The binary erasure channel gives the straight line 1 minus epsilon. A dashed line at 0.5 crosses the symmetric curve at p = 0.110 and p = 0.890 and the erasure line at epsilon = 0.5. A square marks the binary symmetric channel with p = 0.1 at 0.5310. crossover probability p, or erasure probability epsilon capacity in bits per channel use 0 0.25 0.5 0.75 1 0 0.25 0.5 0.75 1 BSC(0.1): 0.5310 0.5 bit per use binary symmetric, 1 − h(p) binary erasure, 1 − epsilon
Figure 3. Capacity of the binary symmetric channel, , and of the binary erasure channel, . A flip probability of 0.11 costs as much capacity as an erasure probability of 0.5. Data: computed by ch07_charts.py in the companion repository.

04.The Binary Erasure Channel

The erasure channel BEC(ε)\text{BEC}(\varepsilon) delivers each bit intact with probability 1−ε1 - \varepsilon and otherwise delivers an erasure mark, written ??, which tells the receiver that the bit was lost but not what it was. Here the easier route to the mutual information runs through the input, I(X;Y)=H(X)−H(X∣Y)I(X;Y) = H(X) - H(X \mid Y), the other form from Mutual Information.

With P(X=1)=qP(X = 1) = q, the input entropy is H(X)=h(q)H(X) = h(q). An output of 0 or 1 leaves no uncertainty. An output of ??, which happens with probability ε\varepsilon whatever was sent, says nothing about the input, which keeps its entropy h(q)h(q). Averaging over the outputs gives H(X∣Y)=ε h(q)H(X \mid Y) = \varepsilon\, h(q), and

I(X;Y)=h(q)−ε h(q)=(1−ε) h(q).I(X;Y) = h(q) - \varepsilon\, h(q) = (1 - \varepsilon)\, h(q) .

The largest value of h(q)h(q) is 1, at q=12q = \frac12, so

CBEC=1−ε.C_{\text{BEC}} = 1 - \varepsilon .
(4)

The last column of Table 2 is 0.5 h(q)0.5\, h(q), for instance 0.5×0.4690=0.23450.5 \times 0.4690 = 0.2345 at q=0.1q = 0.1. A fraction ε\varepsilon of the uses are lost, and the theorem promises that the rest can be used in full, as if the transmitter had known in advance which uses would be erased.

Figure 3 shows that BSC(0.11)\text{BSC}(0.11) and BEC(0.5)\text{BEC}(0.5) have the same capacity, although the first damages 11 bits in a hundred and the second 50. Each flipped bit costs h(0.11)/0.11=4.54h(0.11)/0.11 = 4.54 bits of capacity against exactly 1 for each erased bit, because a flip must also be located.

05.The Gaussian Channel

The Gaussian channel of The Gaussian Channel and BPSK adds to each real input XX an independent Gaussian noise ZZ with mean 0 and variance NN, so Y=X+ZY = X + Z. Inputs spaced far enough apart could always be told apart, so the input power is limited to E[X2]≤PE[X^2] \le P, and the ratio P/NP/N is the signal-to-noise ratio per real dimension.

The output is continuous, so the entropies become the differential entropies of The Rate–Distortion Trade in the previous chapter, h(X)=−∫f(x)log⁡2f(x) dxh(X) = -\int f(x) \log_2 f(x)\, dx for a density ff. With a capital letter inside, h(X)h(X) is a differential entropy, while h(p)h(p) stays the binary entropy function. Table 3 compares three densities of variance 1.

Table 3. Differential entropy of three densities with variance 1

DensityShape at variance 1h(X)h(X) in bits
Uniformflat on an interval of width 232\sqrt31.7925
Laplace12e−2∣x∣\frac{1}{\sqrt2} e^{-\sqrt2 \lvert x \rvert}1.9427
Gaussian12πe−x2/2\frac{1}{\sqrt{2\pi}} e^{-x^2/2}2.0471

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

The three values are log⁡2(23)\log_2 (2\sqrt3), log⁡2(2 e)\log_2(\sqrt2\, e) and 12log⁡2(2πe)\frac12 \log_2(2\pi e). The Gaussian leads the uniform density by 12log⁡2(πe/6)=0.2546\frac12 \log_2(\pi e/6) = 0.2546 bits, the gap that separated entropy-coded quantizer indices from the rate-distortion bound in The Rate–Distortion Trade, and the lemma says no density of the same variance does better.

Proof. Let ff be any density with mean μ\mu and variance σ2\sigma^2, and let ϕ\phi be the Gaussian density with the same mean and variance. Gibbs' inequality, from Relative Entropy and Gibbs' Inequality, holds for densities as it does for probability lists, so ∫flog⁡2(f/ϕ) dx≥0\int f \log_2 (f/\phi)\, dx \ge 0, which rearranges to

h(f)=−∫flog⁡2f dx≤−∫flog⁡2ϕ dx.h(f) = -\int f \log_2 f \, dx \le -\int f \log_2 \phi \, dx .

The logarithm of the Gaussian density is a quadratic,

−log⁡2ϕ(x)=12log⁡2(2πσ2)+(x−μ)22σ2log⁡2e.-\log_2 \phi(x) = \frac12 \log_2 (2\pi\sigma^2) + \frac{(x - \mu)^2}{2\sigma^2} \log_2 e .

Averaging it under ff uses only the variance of ff, since ∫f(x−μ)2dx=σ2\int f (x - \mu)^2 dx = \sigma^2, so the right side equals 12log⁡2(2πσ2)+12log⁡2e=12log⁡2(2πeσ2)\frac12 \log_2 (2\pi\sigma^2) + \frac12 \log_2 e = \frac12 \log_2 (2\pi e \sigma^2) for every such ff. For f=ϕf = \phi the inequality holds with equality, so this value is h(ϕ)h(\phi), and h(f)≤h(ϕ)h(f) \le h(\phi). ■\blacksquare

The capacity follows in three steps. First, I(X;Y)=h(Y)−h(Y∣X)I(X;Y) = h(Y) - h(Y \mid X). Given X=xX = x, the output is x+Zx + Z, a shifted copy of the noise, and shifting a density does not change its differential entropy, so h(Y∣X)=h(Z)=12log⁡2(2πeN)h(Y \mid X) = h(Z) = \frac12 \log_2 (2\pi e N). Second, XX and ZZ are independent, so the variance of YY is at most P+NP + N, and the lemma gives h(Y)≤12log⁡2(2πe(P+N))h(Y) \le \frac12 \log_2 (2\pi e (P + N)). Third, a Gaussian input with variance PP makes YY Gaussian with variance exactly P+NP + N and reaches that bound. Subtracting,

A signal-to-noise ratio of 3 buys 1 bit per use and 15 buys 2, which are 4.77 and 11.76 dB.

Figure 4 gives Shannon's geometric reading of the formula [2]. Over nn uses the received vector has squared length close to n(P+N)n(P + N), by the law of large numbers, so it lies near a sphere of radius n(P+N)\sqrt{n(P + N)}. The noise moves each codeword to a point near a sphere of radius nN\sqrt{nN} around it. In nn dimensions volume grows as the nnth power of the radius, so at most ((P+N)/N)n=(1+P/N)n/2\left(\sqrt{(P + N)/N}\right)^n = (1 + P/N)^{n/2} noise spheres fit without overlapping, and the rate is at most 12log⁡2(1+P/N)\frac12 \log_2 (1 + P/N). It is the noise-cloud count of Equation 1 again, with volume in place of number.

Sphere packing for the Gaussian channel, drawn in two dimensions. A large shaded circle of radius square root of n(P + N) holds every likely received word. Inside it eighteen small green circles, each of radius square root of nN, are the noise spheres around eighteen codeword dots, and none of them overlap. Text below says that the number of codewords is at most the volume ratio, (square root of (P + N)/N) to the power n, which is (1 + P/N) to the power n/2, so the rate is at most half log2(1 + P/N). 0 sqrt(n(P + N)) sqrt(nN) Each codeword (dot) is blurred by noise into a small sphere of radius sqrt(nN). Every received word lies inside the large sphere of radius sqrt(n(P + N)). Spheres that do not overlap number at most (sqrt((P + N)/N))^n = (1 + P/N)^(n/2), so the rate is at most half log2(1 + P/N) bits per channel use.
Figure 4. Sphere packing for the Gaussian channel. Noise spheres of radius must fit inside the sphere of radius that holds the received vectors.

BPSK Against the Gaussian Input

The capacity formula assumes a Gaussian input, which can take any real value. BPSK, from The Gaussian Channel and BPSK, sends only +a+a or −a-a with a2=Pa^2 = P. Scale the amplitude to a=1a = 1, so the noise variance becomes σ2=N/P\sigma^2 = N/P, the reciprocal of the signal-to-noise ratio. With equally likely inputs the output density is p(y)=12p(y∣+1)+12p(y∣−1)p(y) = \frac12 p(y \mid +1) + \frac12 p(y \mid -1), and the mutual information is the average of log⁡2(p(y∣x)/p(y))\log_2 \bigl(p(y \mid x)/p(y)\bigr). For x=+1x = +1,

p(y∣+1)p(y)=21+p(y∣−1)/p(y∣+1)=21+e−2y/σ2,\frac{p(y \mid +1)}{p(y)} = \frac{2}{1 + p(y \mid -1)/p(y \mid +1)} = \frac{2}{1 + e^{-2y/\sigma^2}} ,

because the ratio of the two Gaussian densities is exp⁡(−((y+1)2−(y−1)2)/(2σ2))=e−2y/σ2\exp\bigl(-\bigl((y + 1)^2 - (y - 1)^2\bigr)/(2\sigma^2)\bigr) = e^{-2y/\sigma^2}. Its exponent is minus the log-likelihood ratio L=2y/σ2L = 2y/\sigma^2 of Likelihoods and Log-Likelihood Ratios. Taking log⁡2\log_2 and averaging over YY given X=+1X = +1, and noting that x=−1x = -1 gives the same average by symmetry,

Csoft=1−E[log⁡2(1+e−2Y/σ2)],Y∼N(1,σ2).C_{\text{soft}} = 1 - E\left[ \log_2 \left( 1 + e^{-2Y/\sigma^2} \right) \right], \qquad Y \sim \mathcal{N}(1, \sigma^2) .
(6)

The expectation has no closed form, and the companion script evaluates it by Simpson's rule. A receiver that keeps only the sign of YY makes hard decisions, in the language of Hard and Soft Decisions, and turns the channel into a binary symmetric channel with flip probability Q(1/σ)=Q(P/N)Q(1/\sigma) = Q\bigl(\sqrt{P/N}\bigr), so

Chard=1−h(Q(P/N)).C_{\text{hard}} = 1 - h\bigl( Q(\sqrt{P/N}) \bigr) .
(7)

Table 4. Capacity per real dimension of the Gaussian input, BPSK with soft decisions and BPSK with hard decisions

P/NP/N in dBGaussian inputBPSK, softBPSK, hard
−10-100.06880.06870.0449
−5-50.19820.19770.1353
00.50000.48590.3689
51.02870.85920.7685
101.72970.99680.9908

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

Table 4 and Figure 5 show two regimes. At low signal-to-noise ratio, BPSK with soft decisions loses almost nothing to the Gaussian input, 0.0687 against 0.0688 at −10-10 dB, while hard decisions keep only about two thirds. At high signal-to-noise ratio, two input levels can never carry more than 1 bit, and BPSK saturates while the Gaussian input keeps climbing. Signal sets with many levels exist to follow the Gaussian curve upward.

The low-ratio loss of hard decisions has a clean limit. Write s=P/Ns = P/N. For small ss, the Gaussian capacity is 12log⁡2(1+s)≈s/(2ln⁡2)\frac12 \log_2(1 + s) \approx s/(2 \ln 2), and soft BPSK matches it. For hard decisions the flip probability is Q(s)≈12−s/(2π)Q(\sqrt s) \approx \frac12 - \sqrt{s/(2\pi)}, and near one half the binary entropy function behaves as h(12−δ)≈1−2δ2/ln⁡2h(\frac12 - \delta) \approx 1 - 2\delta^2/\ln 2, so Chard≈2⋅s2π/ln⁡2=s/(πln⁡2)C_{\text{hard}} \approx 2 \cdot \frac{s}{2\pi} / \ln 2 = s/(\pi \ln 2). The ratio is π/2=1.571\pi/2 = 1.571, and at −10-10 dB the table already gives 0.0687/0.0449=1.530.0687/0.0449 = 1.53. To make up the difference, a hard-decision receiver needs π/2\pi/2 times the power, or 1.96 dB.

Bits per real dimension against signal-to-noise ratio from minus 10 to 20 dB. The Gaussian-input capacity half log2(1 + P/N) rises without limit, reaching 0.5 at 0 dB and 3.33 at 20 dB. BPSK with soft decisions follows it closely below about 0 dB and then levels off at 1 bit. BPSK with hard decisions lies below both and also levels off at 1 bit. signal-to-noise ratio P/N in dB bits per real dimension 0 0.5 1 1.5 2 2.5 3 3.5 −10 −5 0 5 10 15 20 Gaussian input, half log2(1 + P/N) BPSK input, soft decisions BPSK input, hard decisions
Figure 5. Capacity per real dimension of the Gaussian channel with a Gaussian input, with BPSK and soft decisions, and with BPSK and hard decisions. Data: computed by ch07_charts.py in the companion repository.

06.Bandwidth and Power

Real links are specified by bandwidth BB in hertz and signal power SS in watts, not by uses of a channel. A signal confined to bandwidth BB is fixed by 2B2B real samples per second, the Nyquist rate, so the band offers 2B2B channel uses per second. If the noise has power spectral density N0/2N_0/2 per real dimension, its power in the band is N=N0BN = N_0 B. Each sample then carries energy S/(2B)S/(2B) against noise variance N0/2N_0/2, a signal-to-noise ratio of S/(N0B)=S/NS/(N_0 B) = S/N per sample. Multiplying the capacity per sample by 2B2B samples per second gives the Shannon–Hartley formula.

Power sits inside the logarithm, so doubling it adds at most one bit per second per hertz, while bandwidth multiplies the logarithm but also admits more noise. The worked example A 20 MHz Link puts numbers on the trade. At the other extreme, hold S/N0=106S/N_0 = 10^6 Hz fixed and widen the band. The capacity is 0.3459 Mbit/s at B=105B = 10^5 Hz, 1.0000 at 10610^6, 1.3750 at 10710^7 and 1.4355 at 10810^8, and it never passes a ceiling. Since log⁡2(1+x)=ln⁡(1+x)/ln⁡2≈xlog⁡2e\log_2(1 + x) = \ln(1 + x)/\ln 2 \approx x \log_2 e for small xx,

Blog⁡2(1+SN0B)⟶SN0log⁡2eas B→∞,B \log_2 \left( 1 + \frac{S}{N_0 B} \right) \longrightarrow \frac{S}{N_0} \log_2 e \quad \text{as } B \to \infty ,

which here is 1.4427 Mbit/s, so unlimited bandwidth buys only a bounded rate.

The trade is usually drawn in terms of the spectral efficiency η=Rb/B\eta = R_b/B, the bit rate per hertz, and the energy per bit EbE_b of Energy per Bit and the Decibel. A rate RbR_b at power SS spends Eb=S/RbE_b = S/R_b joules per bit, so S/N=EbRb/(N0B)=η Eb/N0S/N = E_b R_b/(N_0 B) = \eta\, E_b/N_0. Reliable transmission needs Rb≤CR_b \le C, that is η≤log⁡2(1+η Eb/N0)\eta \le \log_2 (1 + \eta\, E_b/N_0), and solving for the energy per bit,

EbN0≥2η−1η.\frac{E_b}{N_0} \ge \frac{2^\eta - 1}{\eta} .
(9)

Table 5. The least for reliable transmission at spectral efficiency , from

η\eta in bit/s/Hz(2η−1)/η(2^\eta - 1)/\etaIn dB
831.87515.03
610.50010.21
43.7505.74
21.5001.76
11.0000.00
0.50.828−0.82-0.82
0.250.757−1.21-1.21
0.10.718−1.44-1.44
0.010.696−1.58-1.58
0.0010.693−1.59-1.59

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

Table 5 and Figure 6 trace the boundary. Spectrally efficient links pay steeply in energy, 15.03 dB at 8 bit/s/Hz, while slow links approach a floor near −1.59-1.59 dB. Uncoded BPSK sends one bit per real sample, so η=2\eta = 2 in this counting, and Energy per Bit and the Decibel found that it needs 9.59 dB for a bit error probability of 10−510^{-5}. The bound at η=2\eta = 2 is 1.76 dB, so 7.83 dB separates uncoded BPSK from what the theorem allows at the same spectral efficiency, and that gap is what the codes of the rest of this book compete for.

Spectral efficiency eta in bits per second per hertz on a log scale from 0.01 to 10 against Eb/N0 in dB. The boundary curve (2 to the eta minus 1) over eta separates the impossible region on the left from the achievable region on the right. It passes 1.76 dB at eta = 2 and 0 dB at eta = 1, and approaches the dashed vertical Shannon limit at minus 1.59 dB as eta falls. A square marks uncoded BPSK at bit error 1e-5, 9.59 dB at eta = 2, 7.83 dB to the right of the boundary. Eb/N0 in dB spectral efficiency eta in bit/s/Hz (log scale) 0.01 0.1 1 10 −4 0 4 8 12 16 7.83 dB uncoded BPSK bit error 1e-5 Shannon limit −1.59 dB impossible achievable
Figure 6. The bandwidth and power plane. Links to the left of the boundary cannot be reliable at any block length, and uncoded BPSK sits 7.83 dB to the right of it. Data: computed by ch07_charts.py in the companion repository.

07.The Shannon Limit

The floor in Table 5 is a limit, and it can be taken one step at a time. Write 2η=eηln⁡22^\eta = e^{\eta \ln 2} and expand the exponential as a power series,

2η=1+ηln⁡2+(ηln⁡2)22!+(ηln⁡2)33!+⋯ .2^\eta = 1 + \eta \ln 2 + \frac{(\eta \ln 2)^2}{2!} + \frac{(\eta \ln 2)^3}{3!} + \cdots .

Subtracting 1 removes the constant term, and dividing by η\eta lowers every remaining power by one,

2η−1η=ln⁡2+η (ln⁡2)22+η2 (ln⁡2)36+⋯ .\frac{2^\eta - 1}{\eta} = \ln 2 + \eta\, \frac{(\ln 2)^2}{2} + \eta^2\, \frac{(\ln 2)^3}{6} + \cdots .

As η→0\eta \to 0 every term but the first vanishes, and the boundary tends to ln⁡2=0.693147\ln 2 = 0.693147. Every coefficient is positive, so the boundary falls steadily with η\eta and never goes below ln⁡2\ln 2. The slope of the series at zero is (ln⁡2)2/2=0.2402(\ln 2)^2/2 = 0.2402, so at η=0.1\eta = 0.1 the first two terms give 0.6931+0.1×0.2402=0.71720.6931 + 0.1 \times 0.2402 = 0.7172, against the exact 0.7177. Converting to decibels takes one logarithm, log⁡10(0.693147)=−0.15917\log_{10}(0.693147) = -0.15917, so

The wideband limit reaches the same number by another road. With unlimited bandwidth the capacity is (S/N0)log⁡2e(S/N_0) \log_2 e, and a rate RbR_b at that capacity spends Eb=S/Rb=N0/log⁡2e=N0ln⁡2E_b = S/R_b = N_0/\log_2 e = N_0 \ln 2 per bit. Uncoded BPSK at 10−510^{-5} sits 11.18 dB above the Shannon limit, 7.83 dB for having no code and the rest for running at η=2\eta = 2.

A code of rate RR bits per real dimension has η=2R\eta = 2R, and with BPSK as the signal set the boundary comes from Equation 6 and Equation 7 instead of the Gaussian capacity. A channel use spends energy PP to carry RR bits, so Eb=P/RE_b = P/R, and with N0=2NN_0 = 2N, Eb/N0=(P/N)/(2R)E_b/N_0 = (P/N)/(2R). The least signal-to-noise ratio whose capacity reaches RR fixes the least Eb/N0E_b/N_0, collected in Table 6.

Table 6. The least in dB for reliable transmission at code rate , for three signaling choices

Code rate RRGaussian inputBPSK, softBPSK, hard
1/20.000.191.77
1/3−0.55-0.55−0.50-0.501.21
0.1−1.29-1.29−1.29-1.290.59
0.01−1.56-1.56−1.56-1.560.39

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

These are the targets a code designer quotes. A rate one half code with BPSK cannot work below 0.19 dB with soft decisions, or 1.77 dB with hard ones. As the rate falls, soft BPSK approaches the Shannon limit, while hard decisions settle about 1.96 dB above it, the π/2\pi/2 penalty found above.

08.Typical Sequences

The noise-cloud count needs a precise statement of which noise patterns are likely. Take the source of the previous chapter, which emits a 1 with probability p=0.1p = 0.1, and look at blocks of n=20n = 20 symbols, where everything can be counted exactly. A block with kk ones has probability pk(1−p)20−kp^k (1 - p)^{20 - k}, and there are (20k)\binom{20}{k} such blocks. Table 7 lists the first few weights.

Table 7. Blocks of 20 symbols from a source with , grouped by the number of ones

kkBlocksProbability of eachTotal probability−1nlog⁡2p(x)-\frac{1}{n}\log_2 p(x)
010.121580.121580.1520
1200.0135090.270170.3105
21900.00150090.285180.4690
311400.000166770.190120.6275
448450.0000185300.089780.7860
5155040.00000205890.031920.9445

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

The most likely block is all zeros, yet the most likely weight is k=2k = 2, because its 190 blocks outweigh the single block of zeros. The last column, the surprise per symbol, equals the entropy h(0.1)=0.4690h(0.1) = 0.4690 exactly when k/n=pk/n = p. In general,

−1nlog⁡2(pk(1−p)n−k)=−knlog⁡2p−(1−kn)log⁡2(1−p)=h(p)+(kn−p)log⁡21−pp,-\frac1n \log_2 \bigl( p^k (1 - p)^{n - k} \bigr) = -\frac{k}{n} \log_2 p - \left( 1 - \frac{k}{n} \right) \log_2 (1 - p) = h(p) + \left( \frac{k}{n} - p \right) \log_2 \frac{1 - p}{p} ,

where the last step adds and subtracts h(p)=−plog⁡2p−(1−p)log⁡2(1−p)h(p) = -p \log_2 p - (1 - p) \log_2 (1 - p). With (1−p)/p=9(1 - p)/p = 9 and log⁡29=3.1699\log_2 9 = 3.1699, each extra one raises the surprise per symbol by 3.1699/20=0.15853.1699/20 = 0.1585 bits.

For the binary source, the identity above turns the condition into ∣k/n−p∣≤δ/log⁡29|k/n - p| \le \delta/\log_2 9. A window of 0.05 in the fraction of ones is δ=0.05log⁡29=0.1585\delta = 0.05 \log_2 9 = 0.1585. At n=20n = 20 the typical weights are k=1k = 1, 2 and 3, so the typical set holds 20+190+1140=135020 + 190 + 1140 = 1350 blocks, about 210.3992^{10.399}, with total probability 0.74547. Their surprises lie between h−δ=0.3105h - \delta = 0.3105 and h+δ=0.6275h + \delta = 0.6275 bits per symbol, so each has probability between 2−20×0.62752^{-20 \times 0.6275} and 2−20×0.31052^{-20 \times 0.3105}, and their number lies between 220(h−δ)=74.032^{20(h - \delta)} = 74.03 and 220(h+δ)=5996.22^{20(h + \delta)} = 5996.2, around 220h=666.252^{20 h} = 666.25. Table 8 follows the typical set as the block grows.

Table 8. The typical set for a source with and a window of 0.05 in the fraction of ones

nnTypical kkP(T)P(T)log⁡2∣T∣\log_2 \lvert T \rvertn(h−δ)n(h - \delta)n(h+δ)n(h + \delta)
201 to 30.7454710.3996.2112.55
1005 to 150.9364058.08631.0562.75
100050 to 1500.99999972605.30310.50627.49

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

The probability rushes toward 1 while the size stays between the bounds, and the asymptotic equipartition property says this always happens.

Proof. The probability of a block of independent symbols is a product, so its surprise per symbol is an average, −1nlog⁡2p(X1,…,Xn)=1n∑i(−log⁡2p(Xi))-\frac1n \log_2 p(X_1, \dots, X_n) = \frac1n \sum_i \bigl(-\log_2 p(X_i)\bigr), of independent terms whose mean is HH. The weak law of large numbers, from The Law of Large Numbers, says such an average falls within δ\delta of its mean with probability tending to 1, which is P(T)→1P(T) \to 1. For the upper bound on the size, every typical block has probability at least 2−n(H+δ)2^{-n(H + \delta)}, and the probabilities of all blocks add to at most 1, so there are at most 2n(H+δ)2^{n(H + \delta)} of them. For the lower bound, every typical block has probability at most 2−n(H−δ)2^{-n(H - \delta)}, and once P(T)≥1−ϵP(T) \ge 1 - \epsilon there must be at least (1−ϵ) 2n(H−δ)(1 - \epsilon)\, 2^{n(H - \delta)} of them to hold that much probability. ■\blacksquare

Chebyshev's inequality makes the first step quantitative, though loosely. The fraction of ones has variance p(1−p)/n=0.09/np(1 - p)/n = 0.09/n, so the probability of a fraction more than 0.05 from pp is at most 0.09/(0.0025 n)=36/n0.09/(0.0025\, n) = 36/n, which is 0.036 at n=1000n = 1000. The exact value there is 2.8×10−72.8 \times 10^{-7}, because the true probability falls exponentially in nn, as the Chernoff Bound of Probability for Coding shows. Figure 7 plots P(T)P(T) for two windows. A narrower window pins the size closer to 2nH2^{nH} but needs longer blocks before it holds most of the probability.

Probability that a block from a binary source with p = 0.1 is typical, against block length n from 10 to 1000. With the window of 0.05 the probability starts at 0.39 at n = 10, passes 0.94 at n = 100 and is above 0.999 by n = 400. With the narrower window of 0.02 it rises more slowly, to 0.97 at n = 1000. block length n probability of the typical set 0 0.2 0.4 0.6 0.8 1 0 200 400 600 800 1000 ones fraction within 0.05 of p ones fraction within 0.02 of p
Figure 7. The probability of the typical set against block length for a source with , for windows of 0.05 and 0.02 in the fraction of ones. The steps come from the whole number of ones a block can hold. Data: computed by ch07_charts.py in the companion repository.

Numbering the typical blocks takes about n(H+δ)n(H + \delta) bits, which recovers the compression rate of Source Coding and Prefix Codes. The noise pattern of BSC(p)\text{BSC}(p) is a block from exactly this source, so it is very likely one of about 2nh(p)2^{n h(p)} typical patterns, the cloud size of Equation 1.

09.The Random Coding Argument

The bound of Equation 1 says no code beats 1−h(p)1 - h(p). Shannon reached it without building a code. He chose the codebook at random and showed that the error averaged over all codebooks is small, so some codebook does at least as well.

Walk through it with numbers. Take n=1000n = 1000 uses of BSC(0.1)\text{BSC}(0.1) and rate R=0.4R = 0.4, below the capacity 0.5310. The codebook has M=2400≈2.58×10120M = 2^{400} \approx 2.58 \times 10^{120} codewords, and every bit of every codeword is chosen by a fair coin flip, independently. The decoder uses the Hamming distance, the number of positions in which two words differ. Given the received word yy, it lists the codewords within distance r=140r = 140 of yy. If there is exactly one, it outputs that codeword's message, and otherwise it declares an error. It is not the best decoder, but whatever it achieves the best decoder achieves too.

Suppose message ww is sent. Two things can go wrong. The first is that the noise flips more than 140 bits, so the sent codeword is not on the list. The number of flips is binomial with n=1000n = 1000 and p=0.1p = 0.1, and the exact tail is P(K>140)=2.424×10−5P(K > 140) = 2.424 \times 10^{-5}. The second is that some other codeword also lies within 140 of yy. Here the randomness of the code does the work. Each other codeword was drawn independently of ww's codeword and of the noise, so it is uniform over all 210002^{1000} words whatever yy is, and the chance that it lands within 140 of yy is the size of that ball divided by 210002^{1000},

121000∑k=0140(1000k)=2−420.29.\frac{1}{2^{1000}} \sum_{k=0}^{140} \binom{1000}{k} = 2^{-420.29} .

There are fewer than 24002^{400} other codewords, and by the union bound of The Union Bound the chance that any of them intrudes is at most 2400×2−420.29=2−20.292^{400} \times 2^{-420.29} = 2^{-20.29}, about 7.8×10−77.8 \times 10^{-7}. Adding the two failures, the error probability averaged over messages and codebooks is at most 2.424×10−5+7.8×10−7=2.50×10−52.424 \times 10^{-5} + 7.8 \times 10^{-7} = 2.50 \times 10^{-5}.

The radius balances the two failures. At r=125r = 125 the tail grows to P(K>125)=0.00453P(K > 125) = 0.00453 while the intruder term shrinks to 2−60.932^{-60.93}, and minimized over every radius the bound is 2.1×10−52.1 \times 10^{-5}. Figure 8 repeats the calculation for three rates and many block lengths.

To pass from one example to every rate below capacity, the ball needs a bound that shows its exponent.

Proof. Expand 1=(ρ+(1−ρ))n1 = (\rho + (1 - \rho))^n and keep only the terms with k≤ρnk \le \rho n, which gives 1≥∑k≤ρn(nk)ρk(1−ρ)n−k1 \ge \sum_{k \le \rho n} \binom{n}{k} \rho^k (1 - \rho)^{n - k}. Write each term's probability factor as (1−ρ)n(ρ/(1−ρ))k(1 - \rho)^n \bigl(\rho/(1 - \rho)\bigr)^k. Because ρ≤12\rho \le \frac12, the ratio ρ/(1−ρ)\rho/(1 - \rho) is at most 1, so its power can only shrink as kk grows, and for k≤ρnk \le \rho n it is at least its value at k=ρnk = \rho n. Every kept term is therefore at least (nk)ρρn(1−ρ)(1−ρ)n=(nk)2−nh(ρ)\binom{n}{k} \rho^{\rho n} (1 - \rho)^{(1 - \rho) n} = \binom{n}{k} 2^{-n h(\rho)}. Summing and multiplying through by 2nh(ρ)2^{n h(\rho)} gives the lemma. ■\blacksquare

For the example, ρ=0.14\rho = 0.14 gives 1−h(0.14)=0.41581 - h(0.14) = 0.4158, so the lemma bounds the intruder chance by 2−415.762^{-415.76} against the exact 2−420.292^{-420.29}, and the union term by 2−15.762^{-15.76}, about 1.8×10−51.8 \times 10^{-5}. The lemma loses a few bits and keeps the exponent, which is all the general argument needs.

Proof. Since hh is continuous and increasing on [0,12][0, \frac12], there is a ρ\rho with p<ρ<12p < \rho < \frac12 and R<1−h(ρ)R < 1 - h(\rho). Decode with radius ρn\rho n. The flips exceed ρn\rho n with probability tending to zero by the weak law of large numbers, since their average fraction is p<ρp < \rho, and the Chernoff bound of Chernoff [6] shows the fall is exponential. By the lemma and the union bound, an intruder appears with probability at most 2nR 2nh(ρ)/2n=2−n(1−h(ρ)−R)2^{nR} \, 2^{n h(\rho)}/2^n = 2^{-n(1 - h(\rho) - R)}, and the exponent is negative. Both terms vanish. ■\blacksquare

Three refinements complete the direct half. A codebook average below ϵ\epsilon means some codebook has average error below ϵ\epsilon. At most half of its codewords can have error above 2ϵ2\epsilon, so discarding the worse half leaves rate R−1/nR - 1/n with every message's error at most 2ϵ2\epsilon, which in the example is rate 0.399 and 5.0×10−55.0 \times 10^{-5}. And a general discrete memoryless channel needs only a new decoder. The codewords are drawn from the input distribution that achieves capacity, and the decoder picks the unique codeword jointly typical with yy, meaning that the pair looks like a typical input and output of the channel. A wrong codeword, independent of yy, passes with probability about 2−nI(X;Y)2^{-n I(X;Y)}, so the union over 2nR2^{nR} codewords vanishes when R<I(X;Y)R < I(X;Y) [5]. Gaussian codebooks do the same for the Gaussian channel [2].

Upper bound on the average block error of a random code over the binary symmetric channel with p = 0.1, against block length n from 100 to 4000, on a log scale from 1e-16 to 1. Each curve uses the best decoding radius. At rate 0.30 the bound falls below 1e-16 near n = 1400, at rate 0.40 it is 2.1e-5 at n = 1000, and at rate 0.45, closer to the capacity 0.5310, it falls more slowly, to 1.1e-7 at n = 4000. block length n average block error, upper bound (log scale) 1e-16 1e-12 1e-8 1e-4 1 0 1000 2000 3000 4000 n = 1000: 2.1e-5 rate 0.30 rate 0.40 rate 0.45 capacity of BSC(0.1): 0.5310
Figure 8. The random coding bound for at three rates. The error falls exponentially in at every rate below capacity, and more slowly the closer the rate comes to it. Data: computed by ch07_charts.py in the companion repository.

10.Fano's Inequality and the Converse

The converse needs a link between error and entropy. If a decoder rarely errs, its input must leave little uncertainty about the message, and Fano's inequality [7] makes that precise.

Take numbers first. A message takes one of M=4M = 4 values, and a decoder guesses it from YY with error probability 0.1. Fano's inequality says the remaining uncertainty is at most h(0.1)+0.1log⁡23=0.4690+0.1585=0.6275h(0.1) + 0.1 \log_2 3 = 0.4690 + 0.1585 = 0.6275 bits, out of the 2 bits the message held. The first term pays for not knowing whether the guess is right, and the second, when it is wrong, for not knowing which of the other 3 values is correct.

Proof. Let EE be 1 when W^≠W\hat W \ne W and 0 otherwise. Expand the uncertainty of the pair (E,W)(E, W) given YY by The chain rule from Information and Entropy in two orders. In the first, H(E,W∣Y)=H(W∣Y)+H(E∣W,Y)H(E, W \mid Y) = H(W \mid Y) + H(E \mid W, Y), and the last term is zero, because WW and YY fix both WW and W^\hat W, hence EE. In the second, H(E,W∣Y)=H(E∣Y)+H(W∣E,Y)H(E, W \mid Y) = H(E \mid Y) + H(W \mid E, Y). By the theorem Conditioning reduces entropy, H(E∣Y)≤H(E)=h(Pe)H(E \mid Y) \le H(E) = h(P_e). The term H(W∣E,Y)H(W \mid E, Y) averages two cases. When E=0E = 0, W=W^W = \hat W is known and the uncertainty is zero. When E=1E = 1, which has probability PeP_e, WW is one of the M−1M - 1 values other than W^\hat W, and How Large Entropy Can Be caps its uncertainty at log⁡2(M−1)\log_2 (M - 1). Equating the two expansions gives the inequality. ■\blacksquare

Now the converse. Let WW be uniform over M=2nRM = 2^{nR} messages, so H(W)=nRH(W) = nR. Split it into what the output reveals and what it leaves,

nR=H(W)=H(W∣Yn)+I(W;Yn).nR = H(W) = H(W \mid Y^n) + I(W; Y^n) .

Fano bounds the first part. Since h(Pe)≤1h(P_e) \le 1 and log⁡2(M−1)<nR\log_2(M - 1) < nR, H(W∣Yn)≤1+Pe nRH(W \mid Y^n) \le 1 + P_e\, nR. For the second part, the encoder fixes XnX^n once WW is known, and the channel output depends on WW only through XnX^n, so H(Yn∣W)=H(Yn∣Xn)H(Y^n \mid W) = H(Y^n \mid X^n) and I(W;Yn)=I(Xn;Yn)I(W;Y^n) = I(X^n;Y^n). The chain rule and the memoryless channel give H(Yn∣Xn)=∑iH(Yi∣Xi)H(Y^n \mid X^n) = \sum_i H(Y_i \mid X_i), while the chain rule and Conditioning reduces entropy give H(Yn)≤∑iH(Yi)H(Y^n) \le \sum_i H(Y_i). Together,

I(Xn;Yn)=H(Yn)−∑i=1nH(Yi∣Xi)≤∑i=1n(H(Yi)−H(Yi∣Xi))=∑i=1nI(Xi;Yi)≤nC.I(X^n;Y^n) = H(Y^n) - \sum_{i=1}^{n} H(Y_i \mid X_i) \le \sum_{i=1}^{n} \bigl( H(Y_i) - H(Y_i \mid X_i) \bigr) = \sum_{i=1}^{n} I(X_i;Y_i) \le nC .

Combining, nR≤1+Pe nR+nCnR \le 1 + P_e\, nR + nC, and dividing by nRnR,

For BSC(0.1)\text{BSC}(0.1) at rate 0.6, above the capacity 0.5310, the bound is 0.0983 at n=100n = 100 and 0.1133 at n=1000n = 1000, approaching 1−0.5310/0.6=0.11501 - 0.5310/0.6 = 0.1150. So no code of rate 0.6 and length at least 1000 has block error below 0.1133. This is the weak converse, which only keeps the error away from zero. The finite-length bounds of Polyanskiy, Poor and Verdú imply the stronger statement that above capacity the error probability of a discrete memoryless channel tends to 1 [8]. With Pe→0P_e \to 0 the converse gives R≤CR \le C, the cloud count of Counting Noise Patterns made rigorous.

Sources over Channels

The opening comparison of the chapter can now be made exact. A source of independent letters with entropy HH bits per letter is to be sent over a channel of capacity CC, using ρ\rho channel uses per letter.

Proof sketch. For the first half, compress blocks of kk letters to about kHkH bits, as in Source Coding and Prefix Codes, and send them with a channel code of rate between H/ρH/\rho and CC. For the second half, Fano's inequality on a block of kk letters from an alphabet of size AA, with the argument of the converse, gives H≤ρC+1/k+Pelog⁡2AH \le \rho C + 1/k + P_e \log_2 A, which forces H≤ρCH \le \rho C as k→∞k \to \infty and Pe→0P_e \to 0. ■\blacksquare

Compression and protection can therefore be designed separately without loss, which is why this book treats source codes and channel codes in different Parts. For the source with p=0.1p = 0.1 over BSC(0.1)\text{BSC}(0.1), 0.8832 uses per letter is the least. Without exact reproduction the condition becomes R(D)≤ρCR(D) \le \rho C, with R(D)R(D) the rate-distortion function of The Rate–Distortion Trade [5], and the worked example Sending a Gaussian Source Without a Code meets that bound with no code at all.

11.What the Theorem Promises and What It Leaves Open

The theorem promises that codes exist at every rate below capacity with error probability as small as desired, and that a code chosen at random is good with high probability. It gives no way to find one. Four gaps separate the promise from a working system.

The first is construction. The random code of the walk-through is a table of 24002^{400} codewords of 1000 bits, about 2.58×101232.58 \times 10^{123} bits with no shorter description, and a practical code needs structure that generates its codewords from a short one.

The second is decoding. The radius decoder and the maximum-likelihood decoder both compare the received word with every codeword, 2.58×101202.58 \times 10^{120} comparisons per block, so the structure must also be one a decoder can exploit.

The third is block length. The proof makes the error small by making nn large, and the curves of Figure 8 fall slowly near capacity. Long blocks mean delay, since a decoder waits for the whole block, and memory to hold it.

The fourth is the finite-length penalty, which says how far below capacity a code of a given length must stay. Polyanskiy, Poor and Verdú showed that the best rate at block length nn and block error ϵ\epsilon is close to

R≈C−Vn Q−1(ϵ),R \approx C - \sqrt{\frac{V}{n}}\, Q^{-1}(\epsilon) ,
(12)

where Q−1Q^{-1} inverts the Q-function of The Gaussian and the Q-Function, and VV is the channel dispersion [8]. For the binary symmetric channel,

V=p(1−p)log⁡221−pp,V = p(1 - p) \log_2^2 \frac{1 - p}{p} ,

which is the variance of the surprise −log⁡2p(z)-\log_2 p(z) of one noise symbol. It is the same fluctuation that blurred the edges of the typical set. For p=0.1p = 0.1, V=0.09×3.16992=0.90436V = 0.09 \times 3.1699^2 = 0.90436 and V=0.95098\sqrt V = 0.95098, and with Q−1(10−3)=3.0902Q^{-1}(10^{-3}) = 3.0902 and Q−1(10−6)=4.7534Q^{-1}(10^{-6}) = 4.7534 the approximation gives Table 9.

Table 9. The normal approximation to the best rate for , whose capacity is 0.5310

nnRate at ϵ=10−3\epsilon = 10^{-3}Rate at ϵ=10−6\epsilon = 10^{-6}
1000.23710.0790
10000.43810.3881
100000.50160.4858

Source: reproduced by ch07_capacity_and_shannons_theorem.py.

At n=1000n = 1000 and ϵ=10−3\epsilon = 10^{-3}, the best code reaches only 0.825 of capacity, and a block of 100 symbols reaches less than half. The full expansion adds a term near log⁡2n/(2n)\log_2 n/(2n), 0.0050 at n=1000n = 1000, small beside the square-root term. Figure 9 plots the approach to capacity. The rest of this book is the search for codes with enough structure to be built and decoded, and good enough to sit near these curves.

Normal approximation to the best rate of a code for the binary symmetric channel with p = 0.1, against block length n from 100 to 10000 on a log scale. For block error 1e-3 the rate is 0.2371 at n = 100, 0.4381 at n = 1000 and 0.5016 at n = 10000. For block error 1e-6 it is 0.0790, 0.3881 and 0.4858. Both approach the dashed capacity line at 0.5310. block length n (log scale) best rate in bits per channel use 0 0.1 0.2 0.3 0.4 0.5 0.6 100 1000 10000 block error 1e-3 block error 1e-6 capacity 0.5310
Figure 9. The finite-length penalty for . The best rate approaches capacity only as fast as , and more slowly for a smaller block error. Data: computed by ch07_charts.py in the companion repository.

12.Looking Ahead

A random code is good on average and can still be bad in detail. In the worked example A Small Random Code Decoded Exactly, 16 random codewords of 12 bits include two pairs that differ in only 2 positions, and the code barely beats sending each of its 4 message bits three times. The weakness is the distance between codewords, which a random choice leaves to chance.

The next chapter, Distance, Detection and Correction, makes distance the design target. It defines the Hamming distance between words and the weight of a word, and shows that a code whose codewords all differ in at least dd positions detects any d−1d - 1 errors and corrects any t=⌊(d−1)/2⌋t = \lfloor (d - 1)/2 \rfloor, the counting behind Hamming's first codes [9]. The theorem of this chapter proves that good codes exist but builds none, and minimum distance is the first handle by which a code can be built and checked. MacKay [10] and Cover and Thomas [5] give further proofs of the coding theorem, and Lin and Costello [11] begin the constructions there.

13.Worked Examples

14.Exercises

References

  1. [1]Shannon, Claude E. (1948). “A Mathematical Theory of Communication.” Bell System Technical Journal, 27(3), pp. 379–423. The paper concludes in the October issue, volume 27, number 4, pages 623 to 656. doi:10.1002/j.1538-7305.1948.tb01338.x
  2. [2]Shannon, Claude E. (1949). “Communication in the Presence of Noise.” Proceedings of the IRE, 37(1), pp. 10–21. doi:10.1109/JRPROC.1949.232969
  3. [3]Feinstein, Amiel (1954). “A New Basic Theorem of Information Theory.” Transactions of the IRE Professional Group on Information Theory, 4(4), pp. 2–22. doi:10.1109/TIT.1954.1057459
  4. [4]Gallager, Robert G. (1965). “A Simple Derivation of the Coding Theorem and Some Applications.” IEEE Transactions on Information Theory, 11(1), pp. 3–18. doi:10.1109/TIT.1965.1053730
  5. [5]Cover, Thomas M. and Thomas, Joy A. (2006). “Elements of Information Theory.” 2nd edition. Wiley-Interscience. doi:10.1002/047174882X
  6. [6]Chernoff, Herman (1952). “A Measure of Asymptotic Efficiency for Tests of a Hypothesis Based on the Sum of Observations.” The Annals of Mathematical Statistics, 23(4), pp. 493–507. doi:10.1214/aoms/1177729330
  7. [7]Fano, Robert M. (1961). “Transmission of Information: A Statistical Theory of Communications.” M.I.T. Press. https://archive.org/details/transmissionofin0000fano
  8. [8]Polyanskiy, Yury and Poor, H. Vincent and Verdú, Sergio (2010). “Channel Coding Rate in the Finite Blocklength Regime.” IEEE Transactions on Information Theory, 56(5), pp. 2307–2359. doi:10.1109/TIT.2010.2043769
  9. [9]Hamming, Richard W. (1950). “Error Detecting and Error Correcting Codes.” Bell System Technical Journal, 29(2), pp. 147–160. doi:10.1002/j.1538-7305.1950.tb00463.x
  10. [10]MacKay, David J. C. (2003). “Information Theory, Inference, and Learning Algorithms.” Cambridge University Press. The author's site offers the whole book free to read on screen. https://www.inference.org.uk/itila/book.html
  11. [11]Lin, Shu and Costello, Jr., Daniel J. (2004). “Error Control Coding: Fundamentals and Applications.” 2nd edition. Pearson Prentice Hall.

— Anirban

Hardware–software at the seam where compilers meet microcode.

FeedbackBook modePaper
error-correction-codinginformation-and-channels