Channel Capacity and Coding

On this page

The previous article asked how to represent a message with fewer bits. Now the question is: when a link makes errors, how can the receiver still identify what was sent?

Sending each bit three times and taking a majority vote is one option, but its rate is . More repetition further reduces the rate. Shannon’s result is stronger: for a suitable channel, fix a positive rate below capacity, then use increasingly long, well-designed block codes to make block error probability tend to zero.

Longer blocks cost delay, storage, and computation. An arbitrary longer code need not perform better. We begin with memoryless channels; logarithms in discrete formulas are base 2 and information is measured in bits.

A channel is a conditional probability model

A channel specifies . The input distribution describes how the sender uses the channel; the conditional distribution describes how the link changes an input. These are different objects.

A binary symmetric channel (BSC) can be written as:

Here is independent of , and noise is independent across uses. A bit flips with probability and stays unchanged with probability .

Average information transfer per use is mutual information:

This is an average for a specified input distribution. It does not assign the same information content to every individual received bit.

Why maximize over input distributions?

Let . An output of 1 can arise from an unchanged input 1 or a flipped input 0:

Given either input, the remaining output uncertainty is the noise entropy . Thus:

For fixed channel parameter , the second term is constant. Increasing mutual information means increasing output entropy .

Preparing the visual
The channel stays fixed; input choices change information

Choose a BSC flip probability p, then vary the fraction of transmitted ones α. The point is current mutual information; the curve covers all α and the dashed line marks capacity C. The formula separates output entropy from noise entropy.

Binary output entropy is at most 1. Uniform input makes , attaining that bound, so:

A point on the curve is mutual information for the current input distribution; the maximum of the curve is capacity. Sending the same deterministic bit every time gives : even a noiseless link then has no new random message to distinguish.

Flip probabilityCapacity (bits/use)Reason
1The input is fully recoverable
About 0.500With uniform input, about half the output entropy comes from unpredictable flips
0Output and input are independent for every input distribution
1Inverting the received bit recovers the input exactly

Maximum randomness at is destructive; deterministic inversion does not lose information. For a general discrete memoryless channel, , and the optimal input need not be uniform. See MIT 6.441, Chapter 16.

What kind of reliability does Shannon’s theorem guarantee?

A block code maps possible messages to codewords of length . Its rate is:

The decoder estimates the message from the entire received block. Let denote block error probability for equally likely messages. It differs from the channel’s individual bit-flip probability .

For a discrete memoryless channel and a fixed , there is a sequence of codes with rates approaching and as . At a fixed , no sequence of codes can make block error probability tend to zero.

R < C R > C C R

Dots represent codewords; the surrounding regions suggest possible noisy receptions. More densely packed messages make overlap harder to avoid. Planar positions are not Hamming distances, and circle size is not error probability; this is a spatial intuition for capacity.

The threshold describes asymptotic achievability. It does not supply the error rate of a particular finite block, or say that arbitrary codes at are reliable. Below capacity, good codes exist; an implementation still needs a code, decoder, and block length.

“More redundancy cannot rescue ” also needs care. Sending additional channel symbols can lower the actual rate, perhaps below capacity. The converse rules out vanishing error while keeping the rate above capacity.

A counting intuition for

For long BSC blocks with , the typical noise patterns have exponential scale . Each codeword produces a region of plausible received sequences. With about codewords and possible binary received strings, distinguishable high-probability regions suggest:

This connects capacity to the previous article’s typical sets. It is exponential-scale intuition, not a complete finite-length packing proof. The rigorous theorem needs achievability and converse arguments; it also does not require correcting every possible noise event.

First see competing neighborhoods in 64 positions

Enumerate all six-bit received strings. Each radius- neighborhood contains strings; at , this is seven. Disjoint neighborhoods require , but satisfying this count does not ensure a particular codebook has disjoint neighborhoods. The picture checks membership directly rather than interpreting screen distance as Hamming distance.

Preparing the visual
How do noise neighborhoods overlap as messages increase?

Enumerate all 64 six-bit received strings, vary message count and neighborhood radius, and compare overlaps with the independently calculated exact average ML error for BSC p=0.1. Finite neighborhoods and asymptotic capacity counting are distinguished.

Neighborhood overlap, excluded noise tails, and decoding error are different quantities. The exact average maximum-likelihood (ML) block error uses the full BSC distribution for the fixed codebook. Radius only controls what is displayed. Even disjoint neighborhoods can miss noise events with distance greater than .

For long blocks, typical noise sets replace these finite neighborhoods. Their probability approaches one and their exponential size is about . Total demand has exponent , versus receive-space exponent . This motivates the capacity count; the six-bit example does not prove the random-coding theorem. The following Hamming code supplies a concrete error-correcting structure.

A real small code: why does distance 3 correct one error?

The Hamming distance between equal-length binary strings counts their differing positions. A code’s minimum distance is the smallest distance between distinct legal codewords.

If at most positions change and codewords are separated by at least , the transmitted codeword is uniquely closest. The triangle inequality explains why: if a received string were within distance of two codewords, those codewords would be at most apart, contradicting the separation.

The following is an actual Hamming code: four message bits become seven coded bits, with 16 legal codewords and minimum distance 3. Click received positions to inject flips. Every candidate and its distance remain visible.

Preparing the visual
Flip received bits and inspect the protection from distance

Send message 0000 as the all-zero Hamming(7,4) codeword. Toggle any of seven received bits and compare distances to all 16 legal words. One error is corrected; two errors cause miscorrection.

Data occupies positions ; even-parity bits occupy . For data bits , the codeword is:

The all-zero transmitted word makes flips easy to see. This linear code has the same single-error capability for other messages. The example uses nearest-codeword decoding, which is also maximum-likelihood decoding for a BSC with and equally likely messages.

Any one-bit flip is corrected. Two flips place the received string closer to another codeword, causing miscorrection. In fact, the 16 radius-one neighborhoods exactly cover all received strings. A nearest codeword is always unique, but unique does not mean correct. Higher-weight errors are also outside the single-error guarantee.

This small code does not prove Shannon’s limit. Its rate is fixed at . For BSC , this decoder succeeds exactly when at most one bit flips:

Capacity here is approximately 0.531, below the code’s rate. The example shows how a finite code corrects errors, not how to obtain arbitrarily small error at this fixed rate.

Before Gaussian channels: densities and differential entropy

The preceding sections used discrete probabilities. Real-valued signals use a density ; integrating it over an interval gives probability. A density value is not the probability of an individual real number, and it can exceed one. Differential entropy is

For a uniform distribution over an interval of width , the density is and . It is negative when and changes when the same quantity is expressed in different units. More generally, for when the relevant entropies exist.

Differential entropy therefore is not the number of bits required to encode a real number exactly. Actual coding requires a quantization precision. In the next section, Gaussian output and noise use the same coordinates and units, so their common scale term cancels in the entropy difference. KL and mutual information are invariant under appropriate invertible coordinate changes.

AWGN: where do the logarithm and come from?

A real additive white Gaussian noise channel is:

Noise is independent of the input and across uses, with . The average-power constraint is essential: unlimited signal power would remove any finite capacity bound.

Given , the output is just translated noise, so , where is differential entropy. Gaussian noise has:

Also, . A Gaussian maximizes differential entropy for a given variance, giving:

An independent zero-mean Gaussian input attains equality. Hence:

The latter form supplies a useful interpretation: multiplying a Gaussian’s standard deviation by a factor adds the logarithm of that factor to differential entropy. Expressing this using a variance ratio introduces the square root and thus .

Preparing the visual
A wider Gaussian adds entropy logarithmically

Fix noise variance at 1 and use capacity-achieving Gaussian input. Power P gives output standard deviation √(1+P); capacity is the logarithm of the standard-deviation ratio. A separate entropy strip splits h(Y) into fixed h(N) and added capacity.

Noise variance is fixed at 1 and the input is capacity-achieving Gaussian. At , output equals noise and capacity is zero. At , the standard-deviation ratio is 2 and the entropy difference is 1 bit. At , the ratio is 4 and the difference is 2 bits. Each complete density integrates to 1; capacity is not an area difference between the curves.

This also explains logarithmic power gains. At high SNR, doubling power adds approximately 0.5 bits per real channel use. A binary-input or other restricted constellation generally cannot attain this Gaussian-input capacity. See MIT 6.441, Chapter 17.

For the standard continuous-time real AWGN model with bandwidth and two-sided noise power spectral density , in-band noise power is . Capacity is commonly written bits/s. These units differ from bits per real use; the coefficients cannot be compared without accounting for that distinction.

From a theoretical limit to an implementation

The coding theorem bounds achievable rates. A system must additionally specify block length, target block error probability, decoding latency, power, and computation. Hamming, Reed–Solomon, turbo, LDPC, and polar codes make different structural and implementation tradeoffs. Neither a longer block nor a code-family name alone establishes proximity to capacity.

Random coding proves good codes exist, but storing huge unstructured codebooks and exhaustively decoding them is usually impractical. Engineering seeks structure that permits efficient encoding and decoding while meeting finite-length requirements.

Source–channel separation: align the units first

Source coding removes predictable redundancy; channel coding adds deliberately structured redundancy for correction. For the classical point-to-point setting of a finite-alphabet stationary ergodic source and a discrete memoryless channel, allowing long blocks makes separate compression and error correction asymptotically optimal for reliable transmission.

Suppose a source produces symbols/s at entropy rate bits/source symbol. A channel is used times/s at capacity bits/use. The condition compares matching units:

For example, 1000 source symbols/s at 0.4 bits/symbol require an asymptotic information rate of 400 bits/s. A channel used 1000 times/s with capacity 0.5 bits/use offers a theoretical budget of 500 bits/s. Compression output and channel-code rates can be chosen between them. Finite-block overhead and the reliability target still require separate calculation.

Short delay, multi-user networks, or other stringent constraints can make separately optimized compression and correction less suitable. See MIT 6.441, Chapter 20. The next article considers allowing some information loss: Rate–Distortion and the Information Bottleneck.

References