TExcelTAD
Home › Information Theory › The Noisy-Channel Coding Theorem

The Noisy-Channel Coding Theorem

Before 1948 engineers believed that to make errors rarer you had to send more slowly: repeat each bit more often, and the rate goes to zero as the error rate does. Shannon proved this is wrong. Every channel has a capacity CC, and at any rate below CC there are codes whose error probability is as small as you like.

Codes, rates and errors

An (n,M)(n, M) block code maps one of MM messages to a codeword of nn channel inputs. Its rate is

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

The decoder maps the nn received symbols back to a message. The block error probability pBp_B is the probability that the decoded message is wrong.

The theorem

For a discrete memoryless channel with capacity CC:

  1. Achievability: for every rate R<CR < C and every ϵ>0\epsilon > 0 there is, for large enough nn, a code of rate at least RR with block error probability below ϵ\epsilon.
  2. Converse: at rates R>CR > C, the error probability is bounded away from zero for every code. More precisely, the bit error rate pbp_b achievable at rate RR satisfies R≤C1−H2(pb)R \le \frac{C}{1 - H_2(p_b)}.
python · try it yourself
import numpy as np

H2 = lambda p: 0.0 if p <= 0 else float(-p * np.log2(p) - (1 - p) * np.log2(1 - p))
f = 0.1
C = 1 - H2(f)
print(f"BSC f = {f}: capacity C = {C:.4f}")
print("highest achievable rate for a target bit error rate pb:")
for pb in [0.1, 0.05, 0.01, 1e-3, 1e-6]:
    print(f"  pb = {pb:g}: R_max = {C / (1 - H2(pb)):.4f}")
BSC f = 0.1: capacity C = 0.5310
highest achievable rate for a target bit error rate pb:
  pb = 0.1: R_max = 1.0000
  pb = 0.05: R_max = 0.7441
  pb = 0.01: R_max = 0.5777
  pb = 0.001: R_max = 0.5371
  pb = 1e-06: R_max = 0.5310

At bit error rate 10−610^{-6}, the maximum rate is essentially CC. Allowing more errors buys a little extra rate; at pb=fp_b = f you can send uncoded bits at rate 1.

The achievable region

Plotting rate against bit error rate splits the plane into what is possible and what is not. Repetition codes sit far inside the possible region, close to the axis: their rate goes to zero as their error rate does.

python · try it yourself
import numpy as np
from scipy.stats import binom

H2 = lambda p: 0.0 if p <= 0 else float(-p * np.log2(p) - (1 - p) * np.log2(1 - p))
f = 0.1; C = 1 - H2(f)
print("repetition codes R_N on a BSC with f = 0.1:")
for N in [1, 3, 5, 9, 15, 25]:
    pb = binom.sf(N // 2, N, f)                 # majority vote fails if more than N/2 bits flip
    limit = C / (1 - H2(pb))
    print(f"  N = {N:2d}: rate {1 / N:.3f}, pb = {pb:.2e},  Shannon allows rate up to {limit:.3f} at this pb")
repetition codes R_N on a BSC with f = 0.1:
  N =  1: rate 1.000, pb = 1.00e-01,  Shannon allows rate up to 1.000 at this pb
  N =  3: rate 0.333, pb = 2.80e-02,  Shannon allows rate up to 0.651 at this pb
  N =  5: rate 0.200, pb = 8.56e-03,  Shannon allows rate up to 0.572 at this pb
  N =  9: rate 0.111, pb = 8.91e-04,  Shannon allows rate up to 0.537 at this pb
  N = 15: rate 0.067, pb = 3.36e-05,  Shannon allows rate up to 0.531 at this pb
  N = 25: rate 0.040, pb = 1.62e-07,  Shannon allows rate up to 0.531 at this pb

To get below pb=10−6p_b = 10^{-6} a repetition code needs rate 125\frac{1}{25}, while the theorem promises codes with rate 0.53. The rest of the course looks at how real codes close this gap (Repetition Codes, Low-Density Parity-Check Codes).

Why it is surprising, and why it works

The proof does not construct a good code. It shows that a randomly chosen code is good on average, using typical sets: the received word is almost surely jointly typical with the transmitted codeword, and the chance that some other random codeword is also jointly typical is about 2−n(I(X;Y)−R)2^{-n(I(X;Y) - R)} per codeword. With 2nR2^{nR} codewords this vanishes when R<I(X;Y)R < I(X; Y) (Random Codes and Typical-Set Decoding). The converse uses Fano's inequality and the data-processing inequality (Why You Cannot Beat Capacity).

Two ingredients are essential: long blocks (so that the law of large numbers makes the noise predictable in aggregate) and sparse codebooks (only 2nR2^{nR} of the 2n2^n possible words are used, leaving room around each codeword).

In software

  • 5G, Wi-Fi 6 and DVB-S2 use LDPC and polar codes that operate within about 1 dB of the Shannon limit on Gaussian channels.
  • Storage systems (SSDs, hard disks) also use LDPC codes; the "Shannon limit" sets how dense the bits can be packed for a given raw error rate.

Exercises

Exercise 1: Rate of a code

A code maps 4 data bits to 7 channel bits. What is its rate? Is it usable on a BSC with f=0.1f = 0.1 at low error probability, in principle?

Answer

Rate 47≈0.571\frac{4}{7} \approx 0.571; no, it exceeds the capacity 0.531.

Solution

47>C\frac{4}{7} > C, so by the converse no code of this rate (of any length) can get the error probability close to zero on this channel. Its errors can still be reduced compared with sending uncoded bits.

Exercise 2: Messages and length

How many messages can a code of rate 0.5 and length 1000 carry?

Answer

25002^{500}.

Solution

M=2nR=21000×0.5M = 2^{nR} = 2^{1000 \times 0.5}.

Exercise 3: Rate for a target error (code)

On a BSC with f=0.05f = 0.05, what is the highest possible rate if a bit error rate of 10−310^{-3} is acceptable?

Answer

About 0.722 bits per use, slightly above the capacity 0.714.

Solution
python · try it yourself
import numpy as np

H2 = lambda p: -p * np.log2(p) - (1 - p) * np.log2(1 - p)
C = 1 - H2(0.05)
print(round(C, 4), round(C / (1 - H2(1e-3)), 4))
0.7136 0.7218

Test yourself

The noisy-channel coding theorem says that below capacity…

  1. the error probability can be made arbitrarily small at a fixed positive rate
  2. the rate must go to zero for reliability
  3. errors are impossible without coding
  4. only repetition codes work

The rate of a code with M codewords of length n is…

  1. log⁡2Mn\frac{\log_2 M}{n}
  2. Mn\frac{M}{n}
  3. nM\frac{n}{M}
  4. log⁡2nM\log_2 \frac{n}{M}

Shannon's proof of achievability uses…

  1. random codes and typical-set decoding
  2. Hamming codes
  3. Huffman trees
  4. the Kraft inequality