Information TheoryComputer Science, Applied · Book 1
0 / 0

Shelves / Information Theory

IT·09

Channel Capacity and the Noisy-Channel Coding Theorem

The most surprising result in information theory: every noisy channel has a capacity, the largest mutual information between its input and output, and below that rate, codes exist that make errors as rare as you like without slowing down; above it, errors can't be avoided. Capacity computed for the symmetric, erasure, Z and typewriter channels; why it's true, by counting noise patterns and by choosing codes at random (measured: random codes at rate 0.25 get better with length, at 0.75 worse); the converse from Fano's inequality; why compression and protection can be designed separately; the Gaussian channel, \(\tfrac12 \log_2(1 + \text{SNR})\), and the −1.59 dB limit; and the codes that finally reached capacity fifty years later.

29 topics · ~34 min read · 12-question quiz
Updated Suggest a correction

Start here

What this chapter answers

What's the most information a channel can carry, and how do you compute it? Why can errors be made as rare as you like without slowing down, as long as you stay below that limit, and why can't they above it? Why do the codes that get close need long blocks? Can compression and protection be designed separately? What limits a channel with continuous noise, like a radio link or a telephone line?

Capacity

The best a channel can do

Chapter 8 found that a binary symmetric channel with equally likely inputs carries 1−h(p) bits per use. But the input distribution is the sender's choice. The capacity is the best choice:

The lab tries several input distributions on the symmetric channel with p=0.1: equally likely inputs give 0.5310 bits, 30 % ones give 0.4558, 10 % give 0.2111. The maximum is at 12, so C=1−h(p)≈0.531. For any channel that treats its inputs symmetrically, equally likely inputs are best; for others, the best inputs have to be computed.

Capacity of some channels

  • Binary symmetric, crossover p: C=1−h(p). Zero at p=12, one bit at p=0 or 1.
  • Binary erasure, erasure probability ε: C=1−ε.
  • The Z channel: 0 always arrives as 0, but 1 becomes 0 half the time. It isn't symmetric, so equally likely inputs aren't best: the lab finds the capacity 0.3219 bits with only 40 % ones, because a 1 is the input that can be damaged.
  • The noisy typewriter: 26 keys, each typing either its own letter or the next one, equally often. The capacity is log213≈3.70 bits, and it shows the theorem in miniature: use only every second key (a, c, e, …), and no two of them can produce the same letter, so 13 messages get through with no errors at all.
  • Chapter 7's sensor with 8 states, right 90 % of the time: 2.25 bits, the mutual information measured there, since it's symmetric.
key pressedletter typed a b c d e f a b c d e f
The noisy typewriter, first six of its 26 keys: each key types its own letter or the next (f's other letter, g, is off the picture). Using only every second key (solid lines), the outputs never overlap.

Computing capacity

For channels without symmetry there's usually no formula, but there is an algorithm. Richard Blahut and Suguru Arimoto (both 1972) found one that improves the input distribution step by step: give more probability to inputs whose outputs stand out most from the average output, and repeat. It converges to the capacity. The lab's capacity function is ten lines long and reproduces every value above.

The noisy-channel coding theorem

The statement

Part 1 is the surprise. Chapter 8's repetition codes made errors rarer only by sending more slowly; Shannon showed that this was a property of repetition, not of noise. A channel that flips one bit in ten can carry 0.53 bits of message per bit sent, and with long enough blocks, nearly all of them correctly. The price isn't rate: it's block length, and with it delay and the work of decoding.

Why it's true: counting the noise

Chapter 8's exercise C2 found that in a long block of n bits, the noise is almost always one of about 2nh(p) typical patterns. Picture each codeword surrounded by a cloud of the received blocks its typical noise can produce, 2nh(p) of them. If the clouds of different codewords don't overlap, the receiver can tell which codeword was sent: find the cloud the received block is in. There are only 2n possible received blocks, so at most

Interactive diagram: Why capacity is 1 − h(p): counting noise clouds. It needs JavaScript; the text around it says the same.
2n2nh(p)=2n(1−h(p))

non-overlapping clouds fit, which is n(1−h(p))=nC bits of message per block. For p=0.1 and n=1000, each codeword's cloud has about 2469 members, and at most 2531 clouds fit: 531 bits of message per 1,000 sent. That's why capacity is an upper limit, and why it has exactly the form 1−h(p): the h(p) is the information the noise adds, which the receiver has to "spend" capacity working out.

Why it's true: random codes

That codes reaching the limit exist is Shannon's other insight. Choose the codewords at random, each bit a fair coin, and decode to the nearest codeword. For a particular sent codeword, the received block lies in its own cloud with high probability, and the chance that some other random codeword also lands near the received block is about 2nR×2−n(1−h(p)) =2−n(C−R), which shrinks exponentially with n when R<C. Averaged over all random codes the error probability goes to zero, so at least one particular code must do at least as well as the average.

Interactive diagram: Random codes below and above capacity. It needs JavaScript; the text around it says the same.

The lab does exactly this: it draws random codes for the channel with p=0.1 (capacity 0.531) and decodes 10,000 blocks each by brute force. At rate 0.25, the block error falls steadily as blocks get longer: 3.7 % with 16 bits, 1.5 % with 32, 0.24 % with 56. Each bit sent four times, the same rate, loses 33 % of blocks of the same 14 data bits. At rate 0.5, just under capacity, errors stay around 26 %: improvement this close to the limit needs far longer blocks than brute force can decode. At rate 0.75, above capacity, longer blocks make things worse: 49 %, 56 %, 61 %.

The catch is in "decodes by brute force": a random code of rate 0.25 with n=1000 has 2250 codewords, and comparing a received block with each is impossible. Random codes prove the theorem; practical codes need structure that makes decoding fast.

The converse: you can't beat capacity

Why can't any code beat C? Suppose a code sends nR bits of message in n uses of the channel. By the data processing inequality (chapter 7), whatever the receiver works out can't carry more information about the message than the received block does, and the received block carries at most nC bits about the input. So at least n(R−C) bits of uncertainty about the message remain. Fano's inequality (chapter 7) turns remaining uncertainty into errors:

P(block error)≥1−CR−1nR.

At R=0.75 on the channel with C=0.531, every code of any length loses at least 29 % of long blocks; the lab's random codes, losing 61 % at n=16, are within that bound. (A stronger result, Wolfowitz's strong converse, shows that above capacity the error probability actually goes to 1.)

Separation: compress, then protect

A source producing H bits per symbol (chapters 4 to 7) has to cross a channel of capacity C per use. Chapter 6 compresses it to about H bits per symbol; this chapter sends bits at any rate below C almost without error. Together:

That's why systems are built in layers: a compressor that knows nothing about the channel (zip, video codecs), and a channel code that knows nothing about the data (Wi-Fi, 5G, disks). Chapter 8 showed why the order matters: compressed data is fragile, so it must be protected, and protection must come after compression, because compressing would remove the protecting redundancy.

The theorem is a statement about the limit of long blocks. With a delay limit (a phone call can't wait), with very short messages, or when one transmission serves receivers with different channels (broadcast), joint designs can do better, which is why some radio and video systems couple the two layers.

The Gaussian channel

Continuous noise

Many channels carry continuous values: a voltage on a wire, a radio wave's strength. The standard model adds noise drawn from a normal distribution with variance N to an input whose average power is limited to P. For continuous variables, entropy becomes differential entropy (chapter 4's exercises), and a normal distribution with variance σ2 has

h=12log2(2πeσ2)

bits. Among all distributions with a given variance, the normal has the largest differential entropy. Then I(X;Y)=h(Y)−h(Y∣X); h(Y∣X) is the noise's entropy, 12log2(2πeN), and h(Y) is largest when Y is normal with variance P+N, which happens when the input is normal too. Subtracting:

What it says

Capacity grows with bandwidth in proportion but with power only logarithmically: doubling the power adds half a bit per use. An analogue telephone line passes about 3 kHz with a signal-to-noise ratio around 30 dB (1,000 to 1); its capacity is about 3000log21001≈30,000 bits per second. The last generation of analogue modems (V.34, in the mid-1990s) reached 33.6 kbit/s, right at the limit for real lines, and faster dial-up needed a digital connection at one end.

The lab compares the Gaussian capacity with what a channel can carry if the sender may only send +1 or −1 (one bit per use, as many simple radios do). At low signal-to-noise ratios the two are nearly the same (0.0688 against 0.0687 bits at −10 dB); at high ones the binary input is stuck at 1 bit while the channel could carry 3.3 bits at 20 dB. That's why fast links send many levels per use (Wi-Fi's and cable modems' constellations of 64 to 4,096 points) when the signal is strong, and fall back to two or four when it's weak.

The Shannon limit

Spreading a fixed power over more and more bandwidth, the energy needed per bit falls towards a minimum: no code can work with less than ln2≈0.693 times the noise's power density per bit, written Eb/N0≥−1.59 dB. The lab computes it from the formula: at rate 1 bit per use, 1.76 dB; at 0.1, −1.29 dB; in the limit, −1.59 dB. Deep-space probes, with almost no power and plenty of time, operate close to this limit, and how close a code gets to it is the standard way to rate codes.

Codes that reach capacity

For forty years after 1948, practical codes stayed well short of capacity. Algebraic codes (Hamming, BCH, Reed–Solomon) have good distances but are decoded by deciding each bit first, which throws away information. Convolutional codes with Viterbi decoding (1967) were the workhorse of space and mobile radio. The breakthroughs all used two ideas: long blocks, as the theorem demands, and iterative soft decoding, where many simple checks pass probabilities back and forth about each bit until they agree.

  • Turbo codes (1993) came within about 0.5 dB of the limit and went into 3G and 4G mobile networks and deep-space missions.
  • Low-density parity-check (LDPC) codes, Gallager's from 1960, rediscovered in 1996: each check involves only a few bits, and decoding passes messages between bits and checks. In 2001, Sae-Young Chung, David Forney, Thomas Richardson and Rüdiger Urbanke designed one within 0.0045 dB of the limit. LDPC codes protect Wi-Fi, 10-gigabit Ethernet, satellite television (DVB-S2), SSDs and 5G data.
  • Polar codes (Arıkan, 2009) provably reach capacity as blocks grow; 5G uses them for its control messages.

Half a century separated the theorem from codes that achieve it: a measure of how much the existence proof left to engineering.

Lab: capacity, measured

Python
"""cap.py: channel capacity, numerically, and random codes, for chapter 9's lab."""
import math
import numpy as np

def h(p):
    """The binary entropy function, in bits."""
    return 0.0 if p <= 0 or p >= 1 else -p * math.log2(p) - (1 - p) * math.log2(1 - p)

def mutual_info(px, W):
    """I(X; Y) in bits for input distribution px and channel matrix W (rows: inputs, columns: outputs)."""
    px, W = np.asarray(px, float), np.asarray(W, float)
    py = px @ W
    total = 0.0
    for x, row in enumerate(W):
        for y, w in enumerate(row):
            if px[x] > 0 and w > 0:
                total += px[x] * w * math.log2(w / py[y])
    return total

def capacity(W, iters=2000):
    """The Blahut-Arimoto algorithm: the input distribution that maximises I(X; Y), and the maximum."""
    W = np.asarray(W, float)
    px = np.full(len(W), 1 / len(W))
    for _ in range(iters):
        py = px @ W
        with np.errstate(divide="ignore", invalid="ignore"):
            d = np.where(W > 0, W * np.log2(W / py), 0).sum(axis=1)   # each input's divergence from the output distribution
        px = px * np.exp2(d)
        px /= px.sum()
    return mutual_info(px, W), px

def random_code(k, n, rng):
    """2^k random codewords of n bits each, as a 0/1 array."""
    return rng.integers(0, 2, size=(2 ** k, n), dtype=np.uint8)

def block_errors(code, p, blocks, rng):
    """Send random codewords through a BSC(p) and decode each to the nearest codeword; return the fraction decoded wrongly."""
    sent = rng.integers(0, len(code), size=blocks)
    noise = (rng.random((blocks, code.shape[1])) < p).astype(np.uint8)
    got = code[sent] ^ noise
    wrong = 0
    for i in range(0, blocks, 256):                      # distances to every codeword, a chunk of blocks at a time
        g = got[i:i + 256].astype(np.int16)
        dist = (g[:, None, :] != code[None, :, :]).sum(axis=2)
        wrong += int((dist.argmin(axis=1) != sent[i:i + 256]).sum())
    return wrong / blocks

Experiment 1: capacities

Python
from cap import h, mutual_info, capacity

p = 0.1
bsc = [[1 - p, p], [p, 1 - p]]
print("binary symmetric channel, p = 0.1: I(X; Y) for different input distributions")
for q in (0.5, 0.3, 0.1, 0.0):
    print(f"  P(X = 1) = {q:<4}  I = {mutual_info([1 - q, q], bsc):.4f} bits")
C, px = capacity(bsc)
print(f"  capacity {C:.4f} at P(X = 1) = {px[1]:.3f};  1 - h(0.1) = {1 - h(0.1):.4f}\n")

channels = {
    "erasure, e = 0.1 (outputs 0, ?, 1)": [[0.9, 0.1, 0], [0, 0.1, 0.9]],
    "Z channel: 1 becomes 0 half the time": [[1, 0], [0.5, 0.5]],
    "useless: p = 0.5": [[0.5, 0.5], [0.5, 0.5]],
    "noisy typewriter: each key hits itself or the next, 26 keys": [[0.5 if y in (x, (x + 1) % 26) else 0 for y in range(26)] for x in range(26)],
    "8-state sensor, right 90 %": [[0.9 if y == x else 0.1 / 7 for y in range(8)] for x in range(8)],
}
for name, W in channels.items():
    C, px = capacity(W)
    print(f"{name:<62} capacity {C:.4f} bits; best inputs {' '.join(f'{v:.3f}' for v in px[:4])}{' ...' if len(px) > 4 else ''}")
Text
binary symmetric channel, p = 0.1: I(X; Y) for different input distributions
  P(X = 1) = 0.5   I = 0.5310 bits
  P(X = 1) = 0.3   I = 0.4558 bits
  P(X = 1) = 0.1   I = 0.2111 bits
  P(X = 1) = 0.0   I = 0.0000 bits
  capacity 0.5310 at P(X = 1) = 0.500;  1 - h(0.1) = 0.5310

erasure, e = 0.1 (outputs 0, ?, 1)                             capacity 0.9000 bits; best inputs 0.500 0.500
Z channel: 1 becomes 0 half the time                           capacity 0.3219 bits; best inputs 0.600 0.400
useless: p = 0.5                                               capacity 0.0000 bits; best inputs 0.500 0.500
noisy typewriter: each key hits itself or the next, 26 keys    capacity 3.7004 bits; best inputs 0.038 0.038 0.038 0.038 ...
8-state sensor, right 90 %                                     capacity 2.2503 bits; best inputs 0.125 0.125 0.125 0.125 ...

For the symmetric channel, equally likely inputs are best, and the capacity is 1−h(0.1)=0.5310. The erasure channel gives 0.9; the Z channel 0.3219 with fewer ones (40 %), because ones are the inputs the channel damages; the useless channel 0; the typewriter log213=3.7004 with all keys equally likely (a code using every second key also reaches it, with no errors); and chapter 7's sensor 2.2503.

Experiment 2: random codes below and above capacity

Python
import math
import numpy as np
from cap import h, random_code, block_errors

rng = np.random.default_rng(9)
p = 0.1
print(f"BSC with p = {p}: capacity {1 - h(p):.3f}. Random codes, nearest-codeword decoding, 10,000 blocks each.\n")
print(f"{'rate':>5}{'n':>5}{'codewords':>11}{'blocks decoded wrongly':>25}")
for rate, ns in ((0.25, (8, 16, 24, 32, 40, 48, 56)), (0.5, (8, 16, 24)), (0.75, (8, 12, 16))):
    for n in ns:
        k = round(rate * n)
        err = block_errors(random_code(k, n, rng), p, 10_000, rng)
        print(f"{rate:>5}{n:>5}{2 ** k:>11,}{err:>25.4f}")
    print()
bit = sum(math.comb(4, j) * p**j * (1 - p)**(4 - j) for j in (3, 4)) + 0.5 * math.comb(4, 2) * p**2 * (1 - p)**2   # a tie is a coin toss
print(f"for comparison, each bit sent 4 times (rate 0.25): a block of 14 data bits is wrong with probability {1 - (1 - bit)**14:.4f}")
Text
BSC with p = 0.1: capacity 0.531. Random codes, nearest-codeword decoding, 10,000 blocks each.

 rate    n  codewords   blocks decoded wrongly
 0.25    8          4                   0.0373
 0.25   16         16                   0.0366
 0.25   24         64                   0.0272
 0.25   32        256                   0.0152
 0.25   40      1,024                   0.0085
 0.25   48      4,096                   0.0051
 0.25   56     16,384                   0.0024

  0.5    8         16                   0.2174
  0.5   16        256                   0.2603
  0.5   24      4,096                   0.2620

 0.75    8         64                   0.4857
 0.75   12        512                   0.5564
 0.75   16      4,096                   0.6126

for comparison, each bit sent 4 times (rate 0.25): a block of 14 data bits is wrong with probability 0.3281

At rate 0.25 (under half of capacity), longer random codes are better: block errors fall from 3.7 % at 16 bits to 0.24 % at 56, against 33 % for repetition at the same rate. At rate 0.5, close to capacity, there's no visible improvement at these lengths. At 0.75, above capacity, longer is worse. The theorem's two halves, measured.

Experiment 3: counting and the converse

Python
import math
from cap import h

p = 0.1
C = 1 - h(p)
print(f"counting: in a block of n bits, the noise is almost always one of about 2^(n h(p)) patterns (h(0.1) = {h(p):.3f})")
for n in (100, 1000, 10000):
    print(f"  n = {n:>6,}: 2^{n} possible received blocks; each codeword's typical noise covers 2^{n * h(p):.0f};"
          f" at most 2^{n * C:.0f} codewords fit: {n * C:.0f} bits of message")
print(f"\nFano's inequality: above capacity, the block error probability is at least 1 - C/R - 1/(nR)   (C = {C:.3f})")
print(f"{'rate R':>7}" + "".join(f"{'n = ' + format(n, ','):>14}" for n in (16, 100, 1000, 10**6)))
for R in (0.6, 0.75, 0.9):
    print(f"{R:>7}" + "".join(f"{max(0, 1 - C / R - 1 / (n * R)):>14.3f}" for n in (16, 100, 1000, 10**6)))
Text
counting: in a block of n bits, the noise is almost always one of about 2^(n h(p)) patterns (h(0.1) = 0.469)
  n =    100: 2^100 possible received blocks; each codeword's typical noise covers 2^47; at most 2^53 codewords fit: 53 bits of message
  n =  1,000: 2^1000 possible received blocks; each codeword's typical noise covers 2^469; at most 2^531 codewords fit: 531 bits of message
  n = 10,000: 2^10000 possible received blocks; each codeword's typical noise covers 2^4690; at most 2^5310 codewords fit: 5310 bits of message

Fano's inequality: above capacity, the block error probability is at least 1 - C/R - 1/(nR)   (C = 0.531)
 rate R        n = 16       n = 100     n = 1,000 n = 1,000,000
    0.6         0.011         0.098         0.113         0.115
   0.75         0.209         0.279         0.291         0.292
    0.9         0.341         0.399         0.409         0.410

The counting argument gives at most nC bits of message per block: 531 per 1,000 bits sent. Fano's bound says that above capacity errors can't be avoided: at rate 0.75, at least 29 % of long blocks are lost, whatever the code.

Experiment 4: the Gaussian channel

Python
import math
import numpy as np

def gauss_capacity(snr):
    return 0.5 * math.log2(1 + snr)

def binary_input_capacity(snr):
    """I(X; Y) for X = +1 or -1 equally likely and Y = X + Gaussian noise: integrate numerically."""
    sigma = math.sqrt(1 / snr)
    y = np.linspace(1 - 12 * sigma, 1 + 12 * sigma, 200_001)
    dens = np.exp(-(y - 1) ** 2 / (2 * sigma**2)) / (sigma * math.sqrt(2 * math.pi))
    return 1 - float(np.sum(dens * np.logaddexp2(0, -2 * y / sigma**2 / math.log(2))) * (y[1] - y[0]))

print(f"{'SNR (dB)':>9}{'SNR':>9}{'Gaussian: 1/2 log2(1 + SNR)':>30}{'inputs +1 or -1 only':>23}")
for db in (-10, -5, 0, 5, 10, 20, 30):
    snr = 10 ** (db / 10)
    print(f"{db:>9}{snr:>9.2f}{gauss_capacity(snr):>30.4f}{binary_input_capacity(snr):>23.4f}")

print("\nthe least energy per bit (Eb/N0) that any code can use, at rate R bits per use:")
for R in (2, 1, 0.5, 0.1, 0.001):
    ebn0 = (2 ** (2 * R) - 1) / (2 * R)
    print(f"  R = {R:<6} Eb/N0 >= {ebn0:.4f}  ({10 * math.log10(ebn0):+.2f} dB)")
print(f"  limit as R -> 0: ln 2 = {math.log(2):.4f}  ({10 * math.log10(math.log(2)):+.2f} dB)")
Text
 SNR (dB)      SNR   Gaussian: 1/2 log2(1 + SNR)   inputs +1 or -1 only
      -10     0.10                        0.0688                 0.0687
       -5     0.32                        0.1982                 0.1977
        0     1.00                        0.5000                 0.4859
        5     3.16                        1.0287                 0.8592
       10    10.00                        1.7297                 0.9968
       20   100.00                        3.3291                 1.0000
       30  1000.00                        4.9836                 1.0000

the least energy per bit (Eb/N0) that any code can use, at rate R bits per use:
  R = 2      Eb/N0 >= 3.7500  (+5.74 dB)
  R = 1      Eb/N0 >= 1.5000  (+1.76 dB)
  R = 0.5    Eb/N0 >= 1.0000  (+0.00 dB)
  R = 0.1    Eb/N0 >= 0.7435  (-1.29 dB)
  R = 0.001  Eb/N0 >= 0.6936  (-1.59 dB)
  limit as R -> 0: ln 2 = 0.6931  (-1.59 dB)

At low signal-to-noise ratios, sending just +1 or −1 loses almost nothing; at high ones it's stuck at 1 bit per use while the channel allows 3.3 (20 dB) or 5.0 (30 dB), so strong links send many levels. No code can use less than −1.59 dB of energy per bit.

Worked examples

Is it possible?

Shannon–Hartley

The converse in numbers

Exercises

Practice

  1. Find the capacity of a binary symmetric channel with p=0.02, and of one with p=0.98.
  2. A binary erasure channel loses 30 % of bits. What's its capacity?
  3. What's the capacity of a noisy typewriter with 32 keys, each typing itself or the next?
  4. A channel's capacity is 0.6 bits per use. Can a code of rate 0.5 have block errors below 10−9? Rate 0.7?
  5. Compute 12log2(1+SNR) at an SNR of 15.
  6. Why don't random codes solve the problem in practice?
  7. State the separation theorem in one sentence.
Answers
  1. 1−h(0.02)≈1−0.141 =0.859 bits, for both.
  2. 0.7 bits per use.
  3. log216=4 bits.
  4. Rate 0.5: yes, with long enough blocks. Rate 0.7: no; errors can't be made small above capacity.
  5. 12log216=2 bits per use.
  6. Decoding them needs comparison with exponentially many codewords; practical codes need structure for fast decoding.
  7. Compressing to the source's entropy and then coding for the channel's capacity, designed independently, works whenever the entropy rate is below the capacity, and nothing works above it.

Harder

  1. Show that the capacity of the binary erasure channel is 1−ε for any input distribution's best choice, by writing I(X;Y) =(1−ε)H(X).
  2. Explain why, for the Z channel, the best input distribution has fewer than half ones.
  3. Two binary symmetric channels with p=0.1 are used one after the other (the output of the first feeds the second). What's the overall crossover probability and capacity? Relate it to the data processing inequality.
  4. A 5 MHz channel has an SNR of 0 dB. Estimate its capacity, and how much it would be with an SNR of 10 dB.
  5. Using the counting argument, explain why a code of rate R for a channel with p=0.25 can't work above about 0.19 bits per use.
Answers
  1. Given X, Y is either X (probability 1−ε) or "?". So H(X∣Y) =εH(X) (an erasure leaves X as uncertain as before; a delivered bit leaves no uncertainty), and I =H(X)−εH(X) =(1−ε)H(X), largest at H(X)=1: C=1−ε.
  2. Sending 1 risks damage (half the time it arrives as 0), sending 0 never does. Each 1 carries less reliable information, so the best mix uses 1 less often than 0; the lab's optimum is 40 % ones. The asymmetry of the channel breaks the symmetry of the best input.
  3. A bit arrives flipped if exactly one of the two channels flips it: 2×0.1×0.9 =0.18. Capacity 1−h(0.18)≈1−0.680 =0.320, less than 0.531: chaining channels can only lose information, the data processing inequality applied to channels.
  4. 0 dB is SNR 1: 5×106×log22 =5 Mbit/s. 10 dB is SNR 10: 5×106×log211≈17.3 Mbit/s.
  5. Each codeword's typical noise covers about 2nh(0.25)=20.811n blocks, so at most 2n/20.811n =20.189n codewords fit without overlapping: about 0.19 bits per use, which is 1−h(0.25).

Challenge

  1. Shannon's random coding argument shows that the average random code is good. Explain why that implies that most random codes are good, and why it doesn't tell you how to find one you can decode.
Discussion

If the average block error over all random codes is P¯, then at most a fraction 1k of the codes can have error above kP¯ (Markov's inequality): with P¯=10−12, at most 1 % of codes have error above 10−10. So almost every random code is good; choosing codewords by tossing coins is fine. What fails is decoding: a random code has no structure, so nearest-codeword decoding compares against 2nR codewords, and for blocks long enough to approach capacity (thousands of bits) that's astronomically many. Even storing the code is impossible. Practical codes trade some of randomness's ideal performance for structure (linearity, sparse checks, recursive construction) that allows decoding in time proportional to the block length; LDPC codes, which are close to random in their pattern of checks but sparse, show that very little is lost.

In real life

Misconceptions and limits

The model to keep

Common misconceptions

Misconception What's actually true Where it's shown
"Fewer errors means sending more slowly." Below capacity, longer blocks reduce errors at a fixed rate. The theorem; Experiment 2
"Capacity is the rate at which errors are tolerable." It's the boundary: below, errors can vanish; above, they can't. The converse
"Longer codes are always better." Above capacity, longer random codes lost more: 49 % to 61 %. Experiment 2
"Equally likely inputs always maximise information." For the Z channel the best input has 40 % ones. Experiment 1
"More power is the way to a faster link." Capacity grows with the logarithm of power but in proportion to bandwidth. Worked example, Shannon–Hartley
"Sending just 0 and 1 is fine at any signal strength." At 20 dB, binary input carries 1 bit per use of a possible 3.3. Experiment 4
"Shannon showed how to build the codes." He proved good codes exist; practical ones took until the 1990s. Codes that reach capacity
"It's better to protect data and then compress it." Compression would remove the protection; compress first, then protect. Separation

Limits and trade-offs

  • Capacity is reached only with long blocks. Long blocks mean delay and memory; for short messages (control signals, sensor readings) the best achievable rate is noticeably below capacity, and how far below is studied in its own right.
  • The channel must be known. Capacity assumes the noise's statistics are known and fixed. Real channels change (a phone moves, rain falls on a satellite link), so systems measure the channel and adapt their rate, with margins.
  • The model can be wrong. Memoryless noise, normal noise, and an average power limit are idealisations; bursts, interference and peak limits change the answer.

Revision sheet

Key ideas

  • Capacity C=maxp(x)I(X;Y), in bits per use.
  • Binary symmetric: 1−h(p) (0.531 at p=0.1); erasure: 1−ε; Z channel: computed (0.3219, 40 % ones); noisy typewriter with 26 keys: log213.
  • Blahut–Arimoto: an algorithm that computes capacity for any discrete channel.
  • Noisy-channel coding theorem: below C, errors can be made arbitrarily small; above C, they can't.
  • Why: about 2nh(p) typical noise patterns per codeword, so about 2n(1−h(p)) codewords fit; random codes achieve it on average.
  • Converse: Fano gives Pe≥1−C/R−1/(nR).
  • Separation: compress to H, then code for C; works if H<C.
  • Gaussian channel: C=12log2(1+P/N) per use, Blog2(1+SNR) per second.
  • Shannon limit: Eb/N0≥ln2, −1.59 dB.
  • Codes near capacity: turbo (1993), LDPC (1960, 1996), polar (2009).

Glossary

  • Channel capacity: the largest mutual information between a channel's input and output over all input distributions; the highest rate at which information can be sent reliably.
  • Noisy-channel coding theorem: Shannon's theorem that every rate below capacity can be achieved with arbitrarily small error and no rate above it can.
  • Random coding: choosing codewords at random to prove that good codes exist.
  • Converse (of a coding theorem): the part that shows rates above the limit are impossible.
  • Z channel: a binary channel in which one input is always received correctly and the other is sometimes received as the first.
  • Noisy typewriter: a channel in which each input produces either itself or the next symbol, equally often.
  • Blahut–Arimoto algorithm: an iterative algorithm for computing the capacity of a discrete memoryless channel.
  • Source–channel separation theorem: the theorem that compressing and then channel coding, designed independently, is optimal in the limit of long blocks.
  • Differential entropy: the counterpart of entropy for continuous variables, defined with a probability density.
  • Gaussian channel: a channel that adds normally distributed noise to a power-limited input.
  • Signal-to-noise ratio (SNR): the ratio of signal power to noise power, often in decibels.
  • Shannon–Hartley theorem: the capacity of a band-limited Gaussian channel, Blog2(1+SNR) bits per second.
  • Shannon limit: the least energy per bit relative to the noise, Eb/N0=ln2 (−1.59 dB), with which reliable communication is possible.
  • LDPC code: a low-density parity-check code, whose checks each involve only a few bits, decoded by passing probabilities between bits and checks.
  • Turbo code: a code built from two simple codes on interleaved data, decoded by exchanging probabilities between two decoders.
  • Polar code: a code that, by combining and splitting channels recursively, provably achieves capacity.