Mathematics

Information Theory: From Bits to the Shannon Limit

A practical tour of information theory for engineers: entropy, source coding and the limits of compression, mutual information and cross-entropy, channel capacity, channel coding from Hamming (7,4) to LDPC, Shannon channel capacity and the Shannon–Hartley formula checked against real Wi-Fi rates, MIMO channel capacity with water-filling, and rate–distortion theory.


Overview


In 1948 Claude Shannon published A Mathematical Theory of Communication and answered two questions that sound like engineering folklore but turn out to have exact answers:

  1. How small can a message be made? Every source has an entropy, a number of bits per symbol below which no lossless compressor can go.
  2. How fast can data be sent through a noisy channel? Every channel has a capacity. Below it, errors can be made as rare as you like with the right code. Above it, they cannot.

Almost everything in a modern radio, a ZIP file or a language model’s training loop is an engineering approximation of those two limits. This post builds the ideas from the ground up, with a worked example in each section:

Section The question it answers
Entropy How much uncertainty, in bits, does a source have?
Source Coding How far can data be compressed without loss?
Mutual Information How much does one signal tell you about another?
Channel Capacity What is the highest reliable rate through a noisy channel?
Channel Coding How do real codes get close to that rate?
Shannon Channel Capacity What is the limit for a radio link with bandwidth BB and noise?
MIMO Channel Capacity What do extra antennas buy?
Rate–Distortion Theory How few bits are needed if some error is acceptable?

The maths needs nothing beyond logarithms and probabilities. If you want the radio side first, see Wi-Fi Overview and MIMO.


Information Is Surprise


Shannon’s first move was to separate information from meaning. A message carries information because the receiver did not know it in advance. A rare event tells you more than a common one, so the information content of an outcome xx with probability p(x)p(x) is defined as

I(x)=−log⁡2p(x)=log⁡21p(x)bitsI(x) = -\log_2 p(x) = \log_2 \frac{1}{p(x)} \quad \text{bits}
Event Probability Information
A fair coin lands heads 1/2 1 bit
A fair die shows 6 1/6 2.58 bits
One card drawn is the ace of spades 1/52 5.70 bits
The sun rises tomorrow ≈ 1 ≈ 0 bits

The logarithm is not arbitrary. It is the only function that makes information from independent events add up: two coin flips have probability 1/41/4 and carry 1+1=21 + 1 = 2 bits. The base only sets the unit: base 2 gives bits, base ee gives nats (1 nat ≈ 1.443 bits), which is what machine learning frameworks use internally.


Entropy


The entropy of a random variable XX is the information you expect to receive, averaged over all outcomes:

H(X)=−∑xp(x)log⁡2p(x)H(X) = -\sum_x p(x) \log_2 p(x)

Entropy measures uncertainty. A fair die has log⁡26=2.58\log_2 6 = 2.58 bits; a loaded die that shows 6 half the time has less, because you can guess its outcome better.

For a variable with only two outcomes, probability pp and 1−p1-p, entropy becomes the binary entropy function:

H2(p)=−plog⁡2p−(1−p)log⁡2(1−p)H_2(p) = -p \log_2 p - (1 - p) \log_2 (1 - p)

Binary entropy H2(p) peaks at 1 bit for p = 0.5, and the capacity of a binary symmetric channel is 1 − H2(p)

A coin that lands heads 90% of the time has H2(0.9)=0.47H_2(0.9) = 0.47 bits per flip. The dashed curve, 1−H2(p)1 - H_2(p), will come back as the capacity of a noisy channel.


Properties worth knowing


Property Formula Meaning
Bounds 0≤H(X)≤log⁡2∣X∣0 \le H(X) \le \log_2 \lvert\mathcal{X}\rvert Zero when one outcome is certain; maximum when all ∣X∣\lvert\mathcal{X}\rvert outcomes are equally likely
Joint entropy H(X,Y)=−∑p(x,y)log⁡2p(x,y)H(X, Y) = -\sum p(x, y) \log_2 p(x, y) Uncertainty about the pair
Conditional entropy H(Y∣X)=−∑p(x,y)log⁡2p(y∣x)H(Y \mid X) = -\sum p(x, y) \log_2 p(y \mid x) Uncertainty left in YY once XX is known
Chain rule H(X,Y)=H(X)+H(Y∣X)H(X, Y) = H(X) + H(Y \mid X) Learn XX, then learn what is left of YY
Conditioning helps H(Y∣X)≤H(Y)H(Y \mid X) \le H(Y) On average, knowing more never increases uncertainty
Independence H(X,Y)=H(X)+H(Y)H(X, Y) = H(X) + H(Y) Only when XX and YY are independent

Why entropy is “the number of bits”: typical sequences


The deepest reason entropy matters is the asymptotic equipartition property (AEP). Draw nn independent symbols from a source with entropy HH. As nn grows, almost all the probability concentrates on about 2nH2^{nH} typical sequences, each with probability close to 2−nH2^{-nH}. Everything else is so unlikely it can be ignored.

Take 100 flips of the 90%-heads coin. There are 21002^{100} possible sequences, but almost every sequence you will actually see has about 90 heads, and there are only about 2100×0.47=2472^{100 \times 0.47} = 2^{47} of those. Give each typical sequence a 47-bit index and you have compressed 100 flips into 47 bits. That is the source coding theorem in one paragraph, and the same counting argument proves the channel coding theorem later.


How much information is in English?


Model of English Entropy per letter
26 letters, all equally likely log⁡226=4.70\log_2 26 = 4.70 bits
Single-letter frequencies (e is common, z is rare) about 4.1 bits
Using the previous few letters as context about 2 to 3 bits
Shannon’s human-prediction experiments (long context) about 0.6 to 1.3 bits

Each row uses more knowledge of the language, and the uncertainty about the next letter falls. That gap between 4.7 bits and about 1 bit is the redundancy of English, and it is exactly what a compressor or a language model exploits.

A few lines of Python estimate the byte-level entropy of a file, counting each byte on its own (no context):

import math, sys
from collections import Counter

data = open(sys.argv[1], "rb").read()
counts = Counter(data)
n = len(data)
h = -sum(c / n * math.log2(c / n) for c in counts.values())
print(f"{h:.3f} bits/byte  (max 8.000)")

A text file typically reports 4 to 5 bits per byte, a compiled binary 5 to 6.5, and a .zip, .jpg or encrypted file very close to 8.000. A value near 8 means the bytes already look random: there is no structure left for a compressor to find.


Source Coding


Source coding is lossless compression: represent the output of a source with as few bits as possible, so that it can be recovered exactly.


Prefix codes and the Kraft inequality


Each symbol gets a binary codeword. To decode a stream without separators, no codeword may be the prefix of another (a prefix code). Codeword lengths ℓi\ell_i for a prefix code exist if and only if they satisfy the Kraft inequality:

∑i2−ℓi≤1\sum_i 2^{-\ell_i} \le 1

Think of each codeword as claiming a share 2−ℓ2^{-\ell} of a budget of 1: a 1-bit codeword uses half of all possible bit strings, a 3-bit codeword one eighth. Short codewords are expensive, so they should go to the symbols that occur most often. The ideal length is ℓi=−log⁡2pi\ell_i = -\log_2 p_i, which is exactly the information content of the symbol.


Huffman codes


David Huffman’s 1952 algorithm builds the optimal prefix code for known probabilities: repeatedly merge the two least likely symbols into one node, until one node remains, then read each symbol’s code off the path from the root.

Huffman tree for five symbols with probabilities 0.4, 0.2, 0.2, 0.1 and 0.1, giving codes 0, 100, 101, 110 and 111

For the five symbols above:

  • Fixed-length code: 5 symbols need ⌈log⁡25⌉=3\lceil \log_2 5 \rceil = 3 bits each.
  • Huffman code: 0.4⋅1+0.6⋅3=2.20.4 \cdot 1 + 0.6 \cdot 3 = 2.2 bits per symbol on average, 27% smaller. Kraft check: 2−1+4⋅2−3=12^{-1} + 4 \cdot 2^{-3} = 1.
  • Entropy: H=0.4log⁡210.4+2⋅0.2log⁡210.2+2⋅0.1log⁡210.1=2.12H = 0.4 \log_2 \tfrac{1}{0.4} + 2 \cdot 0.2 \log_2 \tfrac{1}{0.2} + 2 \cdot 0.1 \log_2 \tfrac{1}{0.1} = 2.12 bits.

The Huffman code is within 0.08 bit of the entropy. That remaining gap exists because codeword lengths must be whole numbers of bits.


The source coding theorem


Shannon proved that entropy is a hard floor. For any uniquely decodable code with average length LL,

H(X)≤L<H(X)+1H(X) \le L < H(X) + 1

where the upper bound is achieved by Huffman coding. Coding blocks of nn symbols together spreads that one wasted bit over nn symbols, so the average per symbol approaches H(X)H(X) as closely as you like.

Method How it approaches entropy Used in
Huffman Optimal whole-bit code per symbol DEFLATE (ZIP, gzip, PNG), JPEG, MP3
Arithmetic coding Encodes a whole message as one number in [0,1)[0, 1), effectively fractional bits per symbol H.264/H.265 (CABAC), JPEG 2000
Asymmetric numeral systems (ANS) Arithmetic-coding efficiency at Huffman speed zstd, LZFSE, JPEG XL
Lempel–Ziv (LZ77, LZ78, LZW) Learns repeated strings on the fly, with no prior model; approaches the entropy rate for long inputs gzip, zstd, GIF

Two consequences matter in practice:

  • No compressor shrinks everything. There are 2n2^n files of nn bits but fewer than 2n2^n shorter ones, so any compressor that shrinks some inputs must grow others. Compression works only because real data is not random.
  • Compression is modelling. A coder can only spend −log⁡2p(x)-\log_2 p(x) bits on a symbol if it knows p(x)p(x). Better predictions mean fewer bits, which is why the best text compressors today are driven by neural language models.

Mutual Information


Mutual information measures how much knowing one variable reduces uncertainty about another:

I(X;Y)=H(X)−H(X∣Y)=H(Y)−H(Y∣X)=H(X)+H(Y)−H(X,Y)I(X; Y) = H(X) - H(X \mid Y) = H(Y) - H(Y \mid X) = H(X) + H(Y) - H(X, Y)

The quantities fit together like areas in a diagram:

Venn-style diagram: H(X) and H(Y) overlap in I(X;Y), with H(X|Y) and H(Y|X) as the remaining parts and H(X,Y) as the whole

Equivalently, mutual information is the KL divergence (defined below) between the joint distribution and the product of the marginals:

I(X;Y)=∑x,yp(x,y)log⁡2p(x,y)p(x) p(y)I(X; Y) = \sum_{x, y} p(x, y) \log_2 \frac{p(x, y)}{p(x)\, p(y)}

It is symmetric, never negative, and zero exactly when XX and YY are independent.


Worked example: does the umbrella tell you the weather?


It rains on 30% of days. On rainy days a colleague carries an umbrella 80% of the time; on dry days, 10% of the time. How much does seeing the umbrella tell you about the weather?

Umbrella No umbrella Total
Rain 0.24 0.06 0.30
Dry 0.07 0.63 0.70
Total 0.31 0.69 1

  • Before looking: H(W)=H2(0.3)=0.881H(W) = H_2(0.3) = 0.881 bits.
  • After seeing an umbrella: P(rain∣umbrella)=0.24/0.31=0.77P(\text{rain} \mid \text{umbrella}) = 0.24 / 0.31 = 0.77, so the remaining uncertainty is H2(0.77)=0.771H_2(0.77) = 0.771 bits.
  • After seeing no umbrella: P(rain∣none)=0.06/0.69=0.087P(\text{rain} \mid \text{none}) = 0.06 / 0.69 = 0.087, leaving H2(0.087)=0.426H_2(0.087) = 0.426 bits.
  • On average: H(W∣U)=0.31×0.771+0.69×0.426=0.533H(W \mid U) = 0.31 \times 0.771 + 0.69 \times 0.426 = 0.533 bits.

So I(W;U)=0.881−0.533=0.348I(W; U) = 0.881 - 0.533 = 0.348 bits: the umbrella removes about 40% of your uncertainty about the weather. A radio channel is the same picture with XX = what was sent and YY = what arrived.


Data processing inequality


If X→Y→ZX \to Y \to Z form a chain (for example, transmitted bits, received signal, decoded bits), then

I(X;Z)≤I(X;Y)I(X; Z) \le I(X; Y)

Processing can only lose information. No amount of clever post-processing at a receiver recovers information that the channel destroyed, and every hard decision (rounding a soft value to 0 or 1) throws some away. That is why modern receivers pass soft information to the decoder.


KL divergence and cross-entropy


Suppose the true distribution is pp but your code (or model) assumes qq. The average number of bits you then spend is the cross-entropy:

H(p,q)=−∑xp(x)log⁡2q(x)=H(p)+DKL(p ∥ q)H(p, q) = -\sum_x p(x) \log_2 q(x) = H(p) + D_{\mathrm{KL}}(p \,\|\, q)

The extra term is the Kullback–Leibler divergence:

DKL(p ∥ q)=∑xp(x)log⁡2p(x)q(x) ≥0D_{\mathrm{KL}}(p \,\|\, q) = \sum_x p(x) \log_2 \frac{p(x)}{q(x)} \ \ge 0

It is the price, in bits per symbol, of believing qq when the truth is pp. It is zero only when q=pq = p, and it is not symmetric, so it is a divergence rather than a distance.

This is exactly the loss used to train a language model, as in the LLM study guide. At each position the model outputs a distribution qq over the next token, and the training loss is the cross-entropy against the token that actually came next. Since H(p)H(p) is fixed by the data, minimising cross-entropy is minimising the KL divergence between the model and the language. A loss of 2.2 nats per token is 2.2×1.443=3.22.2 \times 1.443 = 3.2 bits per token, and its exponential, the perplexity e2.2≈9e^{2.2} \approx 9, means the model is as uncertain as a uniform choice among 9 tokens. A model with lower loss is literally a better compressor: arithmetic coding driven by its predictions would store the text in about that many bits per token.


Channel Capacity


A channel takes an input XX and produces an output YY according to transition probabilities p(y∣x)p(y \mid x). The channel is fixed by physics; the only thing the sender controls is the input distribution p(x)p(x). The capacity is the most mutual information that any input distribution can get through:

C=max⁡p(x)I(X;Y)bits per channel useC = \max_{p(x)} I(X; Y) \quad \text{bits per channel use}

Capacity is a property of the channel alone, not of any particular code or modulation.


Two textbook channels


Binary symmetric channel with crossover probability p, and binary erasure channel with erasure probability epsilon

  • Binary symmetric channel (BSC): each bit is flipped with probability pp, and the receiver cannot tell which ones. This models a hard-decision demodulator in a noisy radio.
  • Binary erasure channel (BEC): each bit either arrives correctly or is marked as lost, with probability ε\varepsilon. This models a packet network where a checksum discards damaged packets.

Watch both channels at work, and drag the slider to change the noise:

For the BSC the capacity follows in three lines:

I(X;Y)=H(Y)−H(Y∣X)=H(Y)−H2(p)≤1−H2(p)I(X; Y) = H(Y) - H(Y \mid X) = H(Y) - H_2(p) \le 1 - H_2(p)

H(Y∣X)=H2(p)H(Y \mid X) = H_2(p) whatever is sent, because the noise flips each bit with probability pp independently of the input. H(Y)H(Y) is at most 1 bit, and it reaches 1 when the input is uniform. So CBSC=1−H2(p)C_{\text{BSC}} = 1 - H_2(p). The same reasoning gives CBEC=1−εC_{\text{BEC}} = 1 - \varepsilon.

Channel Capacity At 10% damage
Noiseless, MM symbols log⁡2M\log_2 M n/a
Binary erasure 1−ε1 - \varepsilon 0.90 bit per use
Binary symmetric 1−H2(p)1 - H_2(p) 0.53 bit per use
BSC with p=0.5p = 0.5 0 output independent of input

An error you know about (an erasure) is much cheaper than one you do not. For channels without a neat closed form, the Blahut–Arimoto algorithm computes capacity numerically by alternately optimising the input distribution and the posterior.


The noisy channel coding theorem


Shannon’s central result: for any rate R<CR < C there exist codes whose error probability goes to zero as the block length grows; for any R>CR > C, the error probability stays bounded away from zero, whatever the code.

The proof is the typical-sequence argument again. A block of nn channel outputs has about 2nH(Y)2^{nH(Y)} typical values, and each input codeword spreads into a “noise ball” of about 2nH(Y∣X)2^{nH(Y \mid X)} of them. The number of codewords whose balls do not overlap, and can therefore be told apart, is about

2nH(Y)2nH(Y∣X)=2nI(X;Y)\frac{2^{nH(Y)}}{2^{nH(Y \mid X)}} = 2^{n I(X; Y)}

which means up to I(X;Y)I(X; Y) bits per channel use, maximised to CC.

This was a shock. Before 1948, engineers assumed that reducing errors meant reducing the rate, all the way to zero. Shannon showed that a noisy channel has a fixed, positive rate at which communication is essentially perfect. The proof uses random codes and very long blocks, so it shows such codes exist without saying how to build or decode them. That is the job of channel coding.


Channel Coding


Channel coding adds structured redundancy so that the receiver can detect and correct errors. A code maps kk data bits to nn coded bits; its rate is R=k/nR = k / n.


Repetition: the naive approach


Send every bit three times and take a majority vote. On a BSC with p=0.1p = 0.1, a decoded bit is wrong only if two or three copies flip:

Pe=3p2(1−p)+p3=0.028P_e = 3p^2(1 - p) + p^3 = 0.028

The error rate drops from 10% to 2.8%, but the rate drops to 1/3. More repetitions push errors lower and the rate towards zero. Capacity says we should be able to send at 0.53 bit per use with errors as rare as we like, so repetition is far from optimal.


Hamming distance and linear codes


The Hamming distance between two codewords is the number of positions where they differ. If every pair of codewords is at least dmin⁡d_{\min} apart, the code can

  • detect up to dmin⁡−1d_{\min} - 1 errors, and
  • correct up to t=⌊(dmin⁡−1)/2⌋t = \lfloor (d_{\min} - 1) / 2 \rfloor errors, by picking the nearest codeword.

Most practical codes are linear: the sum (XOR) of two codewords is another codeword. A linear code is defined by a parity-check matrix H\mathbf{H}: a word c\mathbf{c} is a codeword if and only if HcT=0\mathbf{H}\mathbf{c}^{T} = \mathbf{0}. For a received word r=c+e\mathbf{r} = \mathbf{c} + \mathbf{e}, the syndrome s=HrT=HeT\mathbf{s} = \mathbf{H}\mathbf{r}^{T} = \mathbf{H}\mathbf{e}^{T} depends only on the error pattern, not on which codeword was sent.


Hamming (7,4): correcting one error cheaply


Richard Hamming’s 1950 code protects 4 data bits with 3 parity bits, giving dmin⁡=3d_{\min} = 3 and t=1t = 1. Its parity-check matrix has the binary numbers 1 to 7 as columns:

H=[000111101100111010101]\mathbf{H} = \begin{bmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 \end{bmatrix}

So a single error in position ii produces a syndrome equal to column ii, which is the binary number ii. The same code drawn as three parity circles:

Hamming (7,4) as three parity circles: a single flipped bit makes exactly the circles containing it fail, which identifies its position

In the example, data 1011 becomes codeword 0110011; noise flips position 6 to give 0110001. The syndrome is HrT=(1,1,0)T\mathbf{H}\mathbf{r}^{T} = (1, 1, 0)^{T}, binary 6, so the decoder flips bit 6 back. Hamming (7,4) is also a perfect code: its 24=162^4 = 16 codewords, each with the 7 words one flip away, fill all 16×8=128=2716 \times 8 = 128 = 2^7 possible words exactly.

Code Rate Corrects Block error rate at p = 0.01
No coding (4 bits) 1 nothing 1−0.994=3.9%1 - 0.99^4 = 3.9\%
Repetition ×3 (4 bits) 0.33 1 error per bit about 0.12%
Hamming (7,4) 0.57 1 error per block about 0.20%

Hamming gets almost the reliability of triple repetition at 70% more throughput. The same syndrome idea is how ECC memory corrects single-bit errors (usually with an extended Hamming code over 64 data bits).


Modern codes: getting close to capacity


Code family Idea Where you meet it
Convolutional + Viterbi Each output depends on a sliding window of input bits; decode by the most likely path Wi-Fi BCC, GSM, satellite links
Reed–Solomon Works on bytes; corrects bursts CDs, QR codes, DVB, RAID-6
Turbo codes (1993) Two simple encoders plus an interleaver, decoded iteratively 3G and 4G LTE data
LDPC (Gallager 1962, rediscovered 1990s) Sparse parity-check matrix, decoded by passing beliefs along a graph Wi-Fi 4 onwards, 5G NR data, DVB-S2, 10GBASE-T
Polar codes (2009) Split a channel into very good and very bad sub-channels; send data only on the good ones 5G NR control channels

Turbo and LDPC codes were the breakthrough: with long blocks and soft-decision iterative decoding, they operate within a fraction of a dB of the Shannon limit. The improvement is measured as coding gain, the reduction in Eb/N0E_b/N_0 needed for a target error rate. Uncoded BPSK needs about 9.6 dB for a bit error rate of 10−510^{-5}; QPSK with a long rate-1/2 LDPC code (the same 1 bit/s/Hz) needs about 1.5 dB, a gain of about 8 dB, or more than six times less transmit power. In Wi-Fi, LDPC is optional in 802.11n and 802.11ac but required in Wi-Fi 6 and Wi-Fi 7 for wide channels and the highest MCS, which is part of why 1024-QAM and 4096-QAM are usable at all.


Shannon Channel Capacity


The channels above were discrete. A radio link carries continuous signals with additive noise, and its capacity is the result most people mean by “Shannon’s limit”.


The Gaussian channel


Model each received sample as Y=X+NY = X + N, where the noise NN is Gaussian with power NN and the transmitter is limited to average power PP. Two facts give the answer:

  1. Among all distributions with a given power, the Gaussian has the largest differential entropy, h=12log⁡2(2πeσ2)h = \tfrac{1}{2} \log_2 (2\pi e \sigma^2).
  2. I(X;Y)=h(Y)−h(Y∣X)=h(Y)−h(N)I(X; Y) = h(Y) - h(Y \mid X) = h(Y) - h(N), because once XX is known, the only uncertainty left in YY is the noise.

YY has power P+NP + N, so h(Y)≤12log⁡2(2πe(P+N))h(Y) \le \tfrac{1}{2} \log_2 \big(2\pi e (P + N)\big), with equality for a Gaussian input. Subtracting h(N)h(N):

C=12log⁡2 ⁣(1+PN)bits per real sampleC = \frac{1}{2} \log_2\!\left(1 + \frac{P}{N}\right) \quad \text{bits per real sample}

The Shannon–Hartley formula


A signal of bandwidth BB hertz can carry 2B2B independent real samples per second (the Nyquist rate). Multiplying gives the Shannon–Hartley formula:

C=Blog⁡2 ⁣(1+SN)bits per secondC = B \log_2\!\left(1 + \frac{S}{N}\right) \quad \text{bits per second}

where S/NS/N is the signal-to-noise ratio as a linear ratio, not in dB. This one formula explains the main levers of every radio standard:

  • Bandwidth gives linear gains. Doubling BB doubles CC, which is why Wi-Fi went from 20 MHz to 40, 80, 160 and now 320 MHz channels.
  • Power gives logarithmic gains. At high SNR, each doubling of signal power (+3 dB) adds only one bit per second per hertz.
  • SNR sets the modulation. Bits per symbol cannot exceed log⁡2(1+S/N)\log_2(1 + S/N), so 1024-QAM (10 bits per symbol) needs an SNR of at least 30 dB in theory and more in practice.

Worked example: a 20 MHz Wi-Fi channel


At an SNR of 25 dB, S/N=102.5≈316S/N = 10^{2.5} \approx 316, so

C=20×106×log⁡2(317)≈20 MHz×8.3≈166 Mb/sC = 20 \times 10^6 \times \log_2(317) \approx 20\ \text{MHz} \times 8.3 \approx 166\ \text{Mb/s}

for one spatial stream. A real Wi-Fi 6 link at 25 dB runs around MCS 6 (64-QAM, rate 3/4) at 77 Mb/s, a bit under half the bound. Plotting every MCS against the Shannon curve shows the pattern:

Spectral efficiency vs SNR: the Shannon limit log2(1 + SNR) above the staircase of Wi-Fi 6 and Wi-Fi 7 MCS rates for one stream at 20 MHz

The staircase follows the shape of the curve, about 4 dB per extra bit per hertz against Shannon’s 3 dB, but sits well below it. The gap is not wasted cleverness. It is:

  • Overhead: pilot subcarriers, guard bands, the guard interval and preambles carry no user data.
  • Coding: practical block lengths are a few thousand bits, not infinite, and real decoders are not ideal.
  • Margin: the SNR thresholds include room for fading, phase noise and imperfect channel estimates, so links do not fall over at the first fluctuation.

The Wi-Fi Topology Visualizer on this site uses the same SNR-to-MCS table to predict link rates on a floor plan.


Power versus bandwidth: the Eb/N0 view


Engineers often compare schemes by the energy per bit EbE_b relative to the noise density N0N_0, because that removes the bandwidth from the comparison. With spectral efficiency η=R/B\eta = R / B bits per second per hertz, the SNR is S/N=η Eb/N0S/N = \eta\, E_b / N_0, and the capacity condition η≤log⁡2(1+η Eb/N0)\eta \le \log_2(1 + \eta\, E_b/N_0) becomes

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

The Shannon bound in the Eb/N0 versus spectral efficiency plane, with uncoded BPSK, QPSK, 16-QAM and 64-QAM to the right and an LDPC-coded point close to the bound

Spectral efficiency η Minimum Eb/N0E_b/N_0
→ 0 (unlimited bandwidth) ln⁡2=−1.59\ln 2 = -1.59 dB
1 bit/s/Hz 0 dB
2 bit/s/Hz 1.76 dB
4 bit/s/Hz 5.74 dB
6 bit/s/Hz 10.2 dB

Two regimes appear:

  • Power-limited (η well below 1): extra bandwidth buys a lot of energy saving. Deep-space probes and low-power IoT links live here, with turbo and LDPC codes operating within 1 to 2 dB of the −1.59 dB floor. No code, modulation or antenna trick can send a bit with less energy than that relative to the noise.
  • Bandwidth-limited (η above about 2): every extra bit/s/Hz costs a large step in energy. Wi-Fi, cable and fibre systems live here, using dense QAM and long codes.

MIMO Channel Capacity


With NtN_t transmit and NrN_r receive antennas, the received vector is

y=Hx+n\mathbf{y} = \mathbf{H}\mathbf{x} + \mathbf{n}

where H\mathbf{H} is the Nr×NtN_r \times N_t matrix of complex gains between every pair of antennas. The question is how much the extra antennas add to capacity.


Parallel channels from the SVD


Any matrix has a singular value decomposition H=UΣV∗\mathbf{H} = \mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{*}. If the transmitter precodes with V\mathbf{V} and the receiver combines with U∗\mathbf{U}^{*}, the MIMO channel splits into independent scalar channels

y~i=σi x~i+n~i,i=1,…,rank⁡(H)\tilde{y}_i = \sigma_i\, \tilde{x}_i + \tilde{n}_i, \qquad i = 1, \dots, \operatorname{rank}(\mathbf{H})

each with power gain λi=σi2\lambda_i = \sigma_i^2, the eigenvalues of HH∗\mathbf{H}\mathbf{H}^{*}. Capacity is the sum of the Shannon capacities of these eigen-channels. With the total power split equally across the transmit antennas:

C=log⁡2det⁡ ⁣(I+SNRNt HH∗)=∑ilog⁡2 ⁣(1+SNRNt λi)bit/s/HzC = \log_2 \det\!\left(\mathbf{I} + \frac{\mathrm{SNR}}{N_t}\, \mathbf{H}\mathbf{H}^{*}\right) = \sum_{i} \log_2\!\left(1 + \frac{\mathrm{SNR}}{N_t}\, \lambda_i\right) \quad \text{bit/s/Hz}

Take a fixed real channel

H=[10.50.20.8],HHT=[1.250.600.600.68]\mathbf{H} = \begin{bmatrix} 1 & 0.5 \\ 0.2 & 0.8 \end{bmatrix}, \qquad \mathbf{H}\mathbf{H}^{T} = \begin{bmatrix} 1.25 & 0.60 \\ 0.60 & 0.68 \end{bmatrix}

whose eigenvalues are λ1=1.63\lambda_1 = 1.63 and λ2=0.30\lambda_2 = 0.30. At SNR = 20 dB (100), each antenna gets half the power:

C=log⁡2(1+50×1.63)+log⁡2(1+50×0.30)=6.37+4.00=10.4 bit/s/HzC = \log_2(1 + 50 \times 1.63) + \log_2(1 + 50 \times 0.30) = 6.37 + 4.00 = 10.4\ \text{bit/s/Hz}

A single-antenna link with unit gain at the same SNR gives log⁡2101=6.66\log_2 101 = 6.66 bit/s/Hz. The second eigen-channel is weaker, but it still adds 4 bits per hertz: about 56% more capacity from the same total power.


Capacity grows with the number of antennas


In a rich scattering environment, modelled as i.i.d. Rayleigh fading, H\mathbf{H} has up to min⁡(Nt,Nr)\min(N_t, N_r) strong eigenvalues. Averaging the capacity over many random channels gives:

Average MIMO capacity versus SNR for 1×1, 2×2 and 4×4 i.i.d. Rayleigh channels, showing capacity growing roughly in proportion to the number of antennas

At high SNR the capacity behaves like

C≈min⁡(Nt,Nr) log⁡2SNR+constantC \approx \min(N_t, N_r)\, \log_2 \mathrm{SNR} + \text{constant}

so each extra pair of antennas adds another full log⁡2SNR\log_2 \mathrm{SNR}, roughly another stream’s worth of capacity. The slope min⁡(Nt,Nr)\min(N_t, N_r) is the multiplexing gain. Compare a single antenna, where doubling the power only adds one bit per hertz. That is the information-theoretic reason behind spatial streams in Wi-Fi and massive MIMO in 5G, covered from the radio side in MIMO.


Water-filling: when the transmitter knows the channel


If the transmitter knows H\mathbf{H} (in Wi-Fi, from channel sounding with NDP frames before beamforming), it can do better than equal power. The optimal allocation is water-filling:

Pi=(μ−N0λi)+,∑iPi=PP_i = \left(\mu - \frac{N_0}{\lambda_i}\right)^{+}, \qquad \sum_i P_i = P

Picture each eigen-channel as a vessel whose floor is at height N0/λiN_0 / \lambda_i (high for weak channels), then pour the total power in like water until it reaches a common level μ\mu. Strong channels get more power; channels whose floor is above the water level get none.

Water-filling over three eigen-channels with gains 2, 1 and 0.25: the two strong channels receive power 1.75 and 1.25, the weak channel none, giving 3.34 bit/s/Hz against 2.91 for equal power

Water-filling matters most at low SNR, where power is scarce. For the 2×2 example above at 0 dB, equal power gives 1.06 bit/s/Hz, while putting all the power on the strong eigen-channel gives log⁡2(1+1.63)=1.39\log_2(1 + 1.63) = 1.39 bit/s/Hz, 31% more. At 20 dB the two strategies differ by less than 0.01 bit/s/Hz, which is why equal power is a reasonable default at high SNR.


What limits MIMO in practice


  • Correlation: antennas too close together, or a strong line-of-sight path, make the columns of H\mathbf{H} similar. The small eigenvalues collapse and the extra streams disappear.
  • Rank: a “keyhole” (for example, a single doorway between rooms) can make H\mathbf{H} nearly rank one even with many antennas at each end.
  • Channel knowledge: precoding needs accurate, fresh channel estimates. Sounding costs airtime and goes stale as people and devices move.
  • Device limits: Wi-Fi 6 and Wi-Fi 7 define up to 8 spatial streams, but phones usually have 2 antennas, so a single client rarely uses more than 2 streams. Multi-user MIMO serves several clients at once to use the rest.

Rate–Distortion Theory


Images, audio and video do not need exact reconstruction. Rate–distortion theory is the lossy counterpart of source coding: given a distortion measure d(x,x^)d(x, \hat{x}) and an allowed average distortion DD, what is the fewest bits per sample needed?

R(D)=min⁡p(x^∣x) : E[d(X,X^)]≤DI(X;X^)R(D) = \min_{p(\hat{x} \mid x)\,:\ \mathbb{E}[d(X, \hat{X})] \le D} I(X; \hat{X})

The minimum is over all ways of producing the reconstruction X^\hat{X} from XX that keep the distortion within DD. R(D)R(D) falls as DD grows: at D=0D = 0 (for a discrete source) it equals the entropy H(X)H(X), and it reaches zero when the distortion allowed is as large as just guessing.

Rate–distortion curves for a Gaussian source, R = ½ log2(σ²/D), and a fair binary source with bit-error distortion, R = 1 − H2(D)


Two closed forms


Source Distortion R(D)R(D)
Binary, P(1)=pP(1) = p Fraction of bits wrong (Hamming) H2(p)−H2(D)H_2(p) - H_2(D) for D≤min⁡(p,1−p)D \le \min(p, 1 - p)
Gaussian, variance σ2\sigma^2 Mean squared error 12log⁡2(σ2/D)\tfrac{1}{2} \log_2 (\sigma^2 / D) for D≤σ2D \le \sigma^2

  • Binary example: for a fair binary source, accepting 10% bit errors needs only 1−H2(0.1)=0.531 - H_2(0.1) = 0.53 bits per source bit, almost half.
  • Gaussian example: a sensor reading reconstructed to 30 dB signal-to-distortion ratio needs D=σ2/1000D = \sigma^2 / 1000, so R=12log⁡21000=4.98R = \tfrac{1}{2} \log_2 1000 = 4.98 bits per sample.

Turn the Gaussian formula around and every extra bit cuts the distortion by a factor of 4, which is 10log⁡104=6.0210 \log_{10} 4 = 6.02 dB. That is the familiar “6 dB per bit” rule for ADCs: a 16-bit converter has about 96 dB of dynamic range.


Reverse water-filling and transform coding


For several independent Gaussian components with variances σi2\sigma_i^2 (for example, the DCT coefficients of an image block), the optimal bit allocation is reverse water-filling: choose a level θ\theta and give each component distortion Di=min⁡(θ,σi2)D_i = \min(\theta, \sigma_i^2), with rate

Ri=12log⁡2σi2DiR_i = \frac{1}{2} \log_2 \frac{\sigma_i^2}{D_i}

Components with variance below θ\theta get zero bits: they are simply dropped. That is what JPEG, AAC, H.264 and their successors do: transform the signal so that energy collects in a few components, spend bits on those, and quantise the rest to zero.


Source–channel separation


Shannon’s last big result ties everything together. A source can be sent over a channel and reconstructed with distortion DD if and only if

R(D)≤CR(D) \le C

(per source sample, with the channel uses matched to the samples). And it can be done optimally in two separate steps: compress to R(D)R(D) bits with a source code, then protect those bits with a channel code at a rate below CC. This separation theorem is why the internet can treat a video codec and a Wi-Fi PHY as independent layers. It holds for long blocks; for very short delays or broadcast to receivers with different SNRs, joint source–channel designs can still win.


Where It Shows Up


Field Information theory idea
Wi-Fi and cellular Shannon–Hartley sets the rate ceiling; LDPC and polar codes approach it; MIMO adds parallel streams; link adaptation picks the MCS from SNR
Networking Erasure codes (Reed–Solomon, fountain codes) recover lost packets without retransmission
Storage ECC memory, RAID-6 parity and SSD LDPC codes; DEFLATE and zstd compression
Media Rate–distortion and transform coding in JPEG, AAC, H.264/H.265, AV1
Machine learning Cross-entropy loss, KL divergence in variational methods, perplexity, decision-tree information gain
Security Entropy of passwords and keys; a perfect cipher (one-time pad) needs a key with as much entropy as the message

Summary


  1. Entropy is average surprise, H(X)=−∑plog⁡2pH(X) = -\sum p \log_2 p, and by the AEP it counts how many bits a source really needs.
  2. Source coding cannot beat entropy; Huffman, arithmetic, ANS and Lempel–Ziv approach it, and random data cannot be compressed.
  3. Mutual information measures what one variable reveals about another; processing never increases it, and cross-entropy = entropy + KL divergence is the loss behind language models.
  4. Channel capacity, C=max⁡I(X;Y)C = \max I(X; Y), is the highest rate at which errors can be made arbitrarily rare: 1−H2(p)1 - H_2(p) for a BSC, 1−ε1 - \varepsilon for a BEC.
  5. Channel coding closes the gap: Hamming showed the idea, and LDPC, turbo and polar codes now operate within a fraction of a dB of capacity.
  6. Shannon channel capacity, C=Blog⁡2(1+S/N)C = B \log_2(1 + S/N), scales linearly with bandwidth and logarithmically with power, with an absolute floor of Eb/N0=−1.59E_b/N_0 = -1.59 dB; real Wi-Fi runs a few dB below the curve.
  7. MIMO channel capacity grows with min⁡(Nt,Nr)\min(N_t, N_r): the channel splits into parallel eigen-channels, and water-filling puts power where it helps most.
  8. Rate–distortion theory gives the bits needed for a given quality, 12log⁡2(σ2/D)\tfrac{1}{2}\log_2(\sigma^2/D) for a Gaussian, and the separation theorem lets compression and channel coding be designed independently.

Further Reading


  • Claude E. Shannon, “A Mathematical Theory of Communication”, Bell System Technical Journal, 1948. Still readable, and the first half needs little background.
  • Thomas M. Cover and Joy A. Thomas, Elements of Information Theory, 2nd edition. The standard textbook, covering every section of this post.
  • David J. C. MacKay, Information Theory, Inference, and Learning Algorithms. Free to read online from the author’s site, with excellent chapters on modern codes.
  • David Tse and Pramod Viswanath, Fundamentals of Wireless Communication. Capacity of fading and MIMO channels from an engineer’s point of view.
  • Emre Telatar, “Capacity of Multi-antenna Gaussian Channels”, European Transactions on Telecommunications, 1999. The paper behind the MIMO capacity formula.
  • Tom Richardson and Rüdiger Urbanke, Modern Coding Theory. The reference for LDPC codes and iterative decoding.