What does it mean for A to communicate with B? A does something physical (puts a voltage on a wire, sends a radio wave, magnetizes a spot on a disk), and that act should leave B in a state that reflects what A intended. Every physical process of this kind is disturbed by noise that nobody controls. We say the communication has succeeded when A and B agree on what was sent.

Call what A puts into the channel the input and what B observes the output. The output is random, but its distribution depends on the input. The trouble is that two different inputs can produce the same output. When that happens, B cannot tell which of the two was sent. We say those inputs are confusable.

The way out is to stop using every possible input. We pick a subset of inputs that are so far apart that, with high probability, each output could have come from only one of them. Then B can work backwards from the output to the input with a negligible chance of error.

Restricting the inputs has a cost, because fewer usable inputs means fewer different messages. So the question of this note is: how many inputs can we keep while still being able to tell them apart? If we use the channel times, the answer turns out to grow exponentially with , like . The exponent is the channel capacity. It is the number of bits that each use of the channel can reliably carry. The main result of the note is that can be computed from a simple formula involving mutual information.

This note follows Chapter 7 of Cover & Thomas, Elements of Information Theory (second edition), section by section. It is referred to below as “the book”.

How to read this note

Short calculations are shown in the text, because they are the quickest way to see where a formula comes from. Longer proofs are in collapsed boxes titled Proof. Before each of those, the text explains what the result says and why it is believable, so you can skip every box and still follow the note.

What we use from earlier notes

Every term below is used later. Each has a one-line reminder here and a full treatment in the linked note.

  • Bits. All logarithms are base 2, so information is measured in bits.
  • Entropy : the average uncertainty about , in bits. A fair coin has bit. A variable with possible values has at most bits, reached when all values are equally likely (uniform). See entropy and mutual information.
  • Binary entropy : the entropy of a coin that lands heads with probability . It is at or and largest ( bit) at .
  • Conditional entropy : the uncertainty that remains about once is known. It is an average over the values of : .
  • Mutual information : the number of bits that knowing one variable tells us about the other. It is when they are independent.
  • Typical sequences (the AEP). A long sequence of independent draws of is almost certainly one of about “typical” sequences, all roughly equally likely. See the asymptotic equipartition property.
  • Markov chain : depends on only through . The data processing inequality then says : processing cannot create information. Fano’s inequality says that if can be guessed from with small error probability, then is small. See inequalities, data processing and Fano.
  • Notation. is a block of symbols. i.i.d. means independent and identically distributed. Bernoulli() is a bit that equals with probability . is addition modulo 2 (XOR), so .

1. Channels and Their Capacity

1.1 The discrete memoryless channel

A discrete channel is described by three things:

  • an input alphabet : the set of symbols we are allowed to send,
  • an output alphabet : the set of symbols that can be received,
  • transition probabilities : the probability of observing at the output when we send .

Sending one symbol is called one channel use. The transition probabilities are usually collected in a transition matrix, with one row for each input and one column for each output. The entry in row and column is , so every row sums to . For example, a channel that carries bits and flips each one with probability has the matrix

The channel is memoryless if each output depends only on the input at that moment, and not on earlier inputs or outputs. The noise starts fresh on every use. When we send a block of symbols, the probabilities then simply multiply:

A discrete memoryless channel is abbreviated DMC. Every channel in this note is a DMC.

1.2 The definition of capacity

The channel is given to us. The one thing we choose is how often we send each input symbol. This choice is a probability distribution on the input alphabet, called the input distribution. Once is fixed, the pair has a joint distribution , and we can compute the mutual information : the number of bits that one output symbol tells us about one input symbol.

Definition. The information capacity of a discrete memoryless channel is where the maximum is over all input distributions .

In words: try every way of using the input symbols, and keep the one that makes the output as informative as possible about the input.

This is a formula, and so far nothing more. What we actually care about is an engineering quantity: the highest rate, in message bits per channel use, at which information can be sent with an error probability as small as we like. That quantity is called the operational capacity, and it will be defined carefully in Section 6. Shannon’s channel coding theorem (Section 8) says that the two are the same number. That is why the formula deserves the name capacity, and after Section 8 we stop distinguishing between the two.

1.3 How capacity is calculated

Almost every calculation in this note starts from the same way of writing mutual information:

The output is random for two reasons. Part of the randomness comes from our own choice of input, and part comes from the noise. is the randomness that is still there when the input is known, so it is the noise part. Subtracting it leaves the part that reflects the input. This gives a two-step recipe:

  1. Compute , the uncertainty that the noise adds.
  2. Choose to make as large as possible.

In the examples below, step 1 usually does not depend on at all, so the whole problem reduces to step 2.

Source coding versus channel coding

Redundancy means symbols that carry no new information because they can be predicted from the others. Data compression (source coding) removes redundancy to make the data as short as possible. Channel coding does the opposite: it adds redundancy in a controlled way so that the receiver can undo the errors of the channel. Section 12 shows that the two tasks can be handled separately.


2. Examples of Channel Capacity

The examples go from easy to hard. In the first three we can see the answer directly by counting how many inputs can be told apart, and then check that the formula agrees.

2.1 Noiseless binary channel

Suppose the output is an exact copy of the input, , and the input is a bit. Every bit we send arrives without error, so one error-free bit goes through per channel use. The capacity should be bit.

The formula agrees. There is no noise, so and . A bit has entropy at most , so

achieved by the uniform input .

2.2 Noisy channel with nonoverlapping outputs

Now there are two inputs and four outputs. Input produces output or at random. Input produces output or at random.

A channel with two inputs and four outputs. Input 0 leads to output 1 or 2, input 1 leads to output 3 or 4. The two groups of outputs do not overlap.

This channel looks noisy, because the output is a random consequence of the input. But it is not really noisy. Outputs and can only come from input , and outputs and only from input , so the input can always be determined from the output. Every transmitted bit is recovered without error, and the capacity is again 1 bit per use. (The formula gives the same value, with the uniform input.)

The lesson is that randomness in the output does not hurt by itself. What hurts is overlap: different inputs that can lead to the same output.

2.3 Noisy typewriter

A typewriter has 26 keys. When a key is pressed, the machine prints either that letter or the next letter in the alphabet, each with probability . Z wraps around to A.

Noisy typewriter channel: each input letter is printed correctly or shifted to the next letter, each with probability one half.

Here there is real overlap. A printed B could have come from key A or from key B. But suppose we agree to use only every other key: A, C, E, and so on. Key A prints A or B. Key C prints C or D. The sets of possible outputs no longer overlap, so the receiver always knows which key was pressed.

Zero-error code for the noisy typewriter: only the keys A, C, E are used. A prints A or B, C prints C or D, E prints E or F, so the groups of possible outputs never overlap.

That leaves 13 keys that can be told apart perfectly. Choosing one of 13 keys conveys bits, with no errors at all. By restricting the inputs, we turned the noisy typewriter into a channel with nonoverlapping outputs, like the one in Section 2.2.

The formula gives the same number. Follow the recipe:

  1. Whatever key is pressed, the printed letter is one of two letters with equal probability. So bit, for any .
  2. The output is one of 26 letters, so . A uniform input makes the output uniform, which reaches .

This example is the model for the whole chapter. Section 5 will argue that when a channel is used many times in a row, every channel behaves like a noisy typewriter: it has a subset of input sequences whose possible outputs barely overlap.

HW4 Problem 3: Noisy typewriter (book Problem 7.6)

Consider a 26-key typewriter.

(a) If pushing a key always prints the associated letter, what is the capacity in bits?

(b) Now suppose that pushing a key prints that letter or the next one, with equal probability. Thus A prints A or B, …, and Z prints Z or A. What is the capacity?

(c) What is the highest-rate code with block length one that achieves zero probability of error for the channel in part (b)?

2.4 Binary symmetric channel (BSC)

The input and output are bits, and each bit is flipped with probability , independently of the others. This is the simplest model of a channel with errors, and it already contains most of the difficulty of the general problem.

Binary symmetric channel: input 0 or 1 passes through correctly with probability 1-p, or flips to the other value with probability p.

The typewriter trick does not work here. Both inputs can produce both outputs, so with a single use the inputs always overlap. Worse, when an error happens, a simply arrives as a . Nothing in the received bits shows where the errors are, so in a sense every received bit is unreliable. It is not at all obvious that such a channel can carry information reliably. We will see later that it can. For now we just compute the formula:

The third line holds because, whichever bit we send, the output is “the same bit” with probability and “the other bit” with probability . That is a coin with bias , which has entropy . The last line holds because is a single bit, so . A uniform input makes the output uniform and gives equality. Therefore

What it means. Without noise, a binary symbol carries bit. For each symbol the noise makes a decision, flip or do not flip, and that decision has bits of uncertainty. The capacity is what remains:

Here is another way to see the same thing. If a helper wanted to tell the receiver exactly which bits were flipped, the helper would need about bits per symbol to describe the flips. That is the amount of information the noise takes away.

Capacity of the binary symmetric channel as a function of the flip probability p. The curve equals 1 at p = 0 and p = 1, and drops to 0 at p = 1/2.

Flip probabilityCapacityWhy
bitNo noise.
bitsA little more than half of each symbol survives.
bitsThe output is a fair coin, independent of the input.
bitEvery bit is flipped, so the receiver flips it back.

The last row is worth remembering. A channel that is always wrong is as good as one that is always right. What hurts is not being wrong but being unpredictable.

2.5 Binary erasure channel (BEC)

In the erasure channel, bits are lost instead of corrupted. Each bit either arrives intact, or with probability it is erased and the receiver sees a special symbol in its place. The channel has two inputs and three outputs. A bit that arrives is never wrong, and the receiver knows exactly which positions were erased.

Binary erasure channel: each input bit passes through with probability 1-alpha or is replaced by an erasure symbol e with probability alpha.

Follow the recipe. Given the input, the only uncertainty in the output is “erased or not”, so for any , and

Now we need the largest possible . Since has three values, a first guess is . But no input distribution can achieve that, because we have no control over how often appears: it appears a fraction of the time whatever we do. So we compute honestly. Let , and describe in two stages. First, was the symbol erased? That is a coin with bias , costing bits. Second, if it was not erased, which happens with probability , which bit was it? That costs bits. So

and

where the maximum is reached at .

What it means. A fraction of the bits is lost, so we can recover at most a fraction of them. The capacity cannot be more than . The result says this obvious upper limit can actually be reached. That is not obvious, because the sender does not know in advance which bits will be lost, and so cannot simply put the message into the positions that survive. That it can be done is a consequence of the channel coding theorem.

There is one situation in which reaching is easy. Suppose the receiver can tell the sender what arrived. This is called feedback. Then the sender just repeats each erased bit until it gets through. Each bit gets through with probability , so the rate is . Section 11 shows that feedback never allows more than this: for a discrete memoryless channel, feedback does not increase capacity.

Knowing where the damage is

Compare the two channels when 10% of the symbols are damaged. The erasure channel with has . The symmetric channel with has . Losing a bit costs far less than flipping it, because an erasure tells the receiver where the damage is. On the BSC the receiver has to work that out, and that costs information.

2.6 The Z-channel: when the uniform input is not best

In every example so far, the uniform input was the best one. That happened because those channels treat all inputs alike. It is not a general rule. In the Z-channel (Problem 7.8 in the book), input is always received correctly, while input is received as or with probability each. Its transition matrix (row 1 for input , row 2 for input ) is

Z-channel: input 0 always maps to output 0, input 1 maps to output 0 or 1 each with probability one half.

HW4 Problem 4: The Z-channel (book Problem 7.8)

The Z-channel has binary input and output alphabets and transition probabilities given by the matrix Find the capacity of the Z-channel and the maximizing input probability distribution.

The capacity is bits, reached when is sent with probability . Notice what is different from the earlier examples: here the noise term depends on the input distribution, because only input is noisy. Sending more often makes the output more varied, but it also adds more noise. The best choice balances the two. The curve below shows for every .

Mutual information of the Z-channel as a function of the probability of sending 1. The curve peaks at 0.4 with value about 0.322 bits; the uniform input at 0.5 gives about 0.311 bits.

The best input uses the noisy symbol only of the time. A uniform input would give bits, slightly less. When one input is noisier than the others, it pays to use it less often.


3. Symmetric Channels

The BSC and the noisy typewriter were easy for the same two reasons. Step 1 of the recipe was easy because every input suffers the same noise. Step 2 was easy because a uniform input produced a uniform output. Whenever both of these hold, the capacity can be read directly off the transition matrix.

Consider the channel with transition matrix

Every row contains the numbers in some order, and so does every column. A permutation of a list is the same numbers in a different order, so in this matrix the rows are permutations of each other, and so are the columns.

Let be one row of the matrix. The same steps as for the BSC give

The second line holds because, given any input , the output has the distribution in row , and all rows have the same entropy . The third line holds because an output with values has entropy at most , with equality when the output is uniform. And the uniform input does make the output uniform:

which is times the sum of column . All columns have the same sum, so is the same for every .

So this channel has capacity bits, achieved by the uniform input.

Look at what the calculation used: the rows are permutations of each other, and the column sums are equal. It did not need the columns to be permutations of each other. This leads to two definitions.

Definition. A channel is symmetric if the rows of its transition matrix are permutations of each other and the columns are permutations of each other. It is weakly symmetric if the rows are permutations of each other and all the column sums are equal.

Every symmetric channel is weakly symmetric. The channel

is weakly symmetric (each column sums to ) but not symmetric.

Theorem. For a weakly symmetric channel, and the uniform input achieves it.

What it means. In a weakly symmetric channel every input suffers exactly the same amount of noise, so there is no reason to prefer one input over another, and we use them all equally. The formula is the same subtraction as for the BSC:

No optimization is needed. The noise cost is the entropy of one row.

ChannelRow Capacity
The matrix above bits
The matrix above bits
BSC
Noisy typewriter
Additive noise, distribution of

In the last row, and the noise take values in , is independent of , and addition “mod ” wraps around like a clock: after comes . The noisy typewriter is the case , where is or with probability each.

The BEC and the Z-channel are not weakly symmetric, which is why each needed its own calculation.

HW4 Problem 1: Channel capacity (book Problem 7.18)

Calculate the capacity of the following channels with probability transition matrices.

(a)

(b)

(c)


4. Properties of Channel Capacity

A few general facts follow directly from the definition .

  1. , because mutual information is never negative.
  2. , because . A channel with binary input can never carry more than bit per use.
  3. , for the same reason applied to .
  4. is a continuous function of .
  5. is a concave function of . Concave means shaped like a single hill, with no separate smaller peaks.

Properties 4 and 5 are what make capacity computable. Together with the bounds in 2 and 3, they guarantee that the maximum exists and is finite. And because the function is a single hill, any local maximum is the global maximum. So when we set a derivative to zero, as in the Z-channel, the point we find is the true maximum.

In general there is no closed formula for . It is computed numerically, for example by gradient search or by the Blahut-Arimoto algorithm, an iterative method designed for this problem. The channels in this note are special: symmetry or a small number of parameters lets us solve them by hand.


5. Preview of the Channel Coding Theorem

So far is the answer to an optimization problem. Before proving anything, this section gives the intuitive reason why about bits per use can actually be sent. The idea is the one promised in Section 2.3: for long blocks, every channel looks like the noisy typewriter. It has a subset of input sequences whose possible outputs are essentially disjoint.

Jointly typical decoding: each codeword X^n maps to about 2^nH(Y|X) possible output sequences. The total number of typical Y sequences is 2^nH(Y), giving room for about 2^nI(X;Y) distinguishable codewords.

Fix an input distribution and use the channel times, with large. The argument is a count with three steps.

Step 1: each input sequence produces a cloud of outputs. Send a typical input sequence . The noise makes the exact output unpredictable. But by the AEP, the output almost surely falls in a set of about sequences, all roughly equally likely. Think of this set as a cloud around the input sequence.

  • On the typewriter with , the cloud of key A is , of size .
  • On a BSC, the output differs from the input in about positions. The number of ways to choose those positions is about , and is exactly for this channel.

Step 2: the outputs we ever see form a larger set. Over all inputs, the output sequence is almost surely one of about typical output sequences.

Step 3: count how many clouds fit. To decode without confusion, no two input sequences that we use may produce the same output. So their clouds must not overlap. The set of typical outputs has to be divided into disjoint clouds of size . The number of clouds that fit is at most

So we can send at most about distinguishable sequences of length . Choosing one of them conveys bits in uses, which is bits per use. With the best input distribution, that is bits per use.

For the noisy typewriter with this count is exact: 26 outputs, clouds of size 2, hence 13 distinguishable inputs.

This argument shows only an upper limit: no more than clouds can fit. It does not show that we can actually find that many input sequences with disjoint clouds. The channel coding theorem (Section 8) makes a stronger version of this argument precise and shows that the limit can be reached, with an error probability as small as we like. For that we first need precise definitions.


6. Definitions: Codes, Rate and Error

6.1 The communication system

A communication system: message W goes through an encoder to produce X^n, passes through a noisy channel p(y|x), and the decoder estimates the message from Y^n.

Reading the picture from left to right:

  1. A message is drawn from the index set . There are possible messages.
  2. The encoder turns message into a sequence of channel inputs, the codeword . The number is the block length. The list of all codewords, , is the codebook. Sender and receiver both know it.
  3. The channel corrupts the codeword. The receiver sees a random sequence , distributed as .
  4. The decoder guesses the message using a fixed rule, .

The receiver makes an error if .

Definition. An code for a channel consists of an index set , an encoding function that assigns a codeword to each index, and a decoding function that assigns a guess to every possible received sequence.

In the language of the introduction, the codebook is the nonconfusable subset of inputs. Out of all possible input sequences we use only , chosen so that the channel rarely turns one into something that looks like another.

6.2 Probability of error

There are three ways to measure how often a code fails, and all three appear later.

  • The conditional probability of error for message is the chance of a wrong guess when was sent:
  • The maximal probability of error is the worst case over messages:
  • The average probability of error is the plain average over messages:

If the message is chosen uniformly, then is exactly . An average is never larger than a maximum, so .

The maximal error is the stronger guarantee: it says that every message is protected, not just most of them. One might expect the two measures to behave very differently. Section 8 shows they do not: a code with small average error can be turned into a code with small maximal error at essentially the same rate.

6.3 Rate and achievability

Definition. The rate of an code is

Choosing one of messages conveys bits. The code spends channel uses to deliver them. So the rate is the number of message bits delivered per symbol sent through the channel. It says how much of what we send is message and how much is protection. It is not measured in seconds.

Example: repetition. Take the BSC with flip probability . To protect one message bit, send it three times and let the receiver take a majority vote. This is a code: messages, codewords and , block length . Its rate is . The vote is wrong only when two or three of the copies are flipped, which has probability . That is better than the we get without coding. Repeating five times lowers the error to about and the rate to .

SchemeMessages Block length Rate
Send one raw bit
Repeat a bit 3 times
Repeat a bit 5 times
Hamming code (Section 10)

Turning the formula around, a code of rate and block length has codewords. We call it a code. (When is not a whole number, round it up.) This is the most useful way to think about rate: the number of messages grows exponentially with the block length, and the rate is the exponent. This matches the count of Section 5, where the number of distinguishable sequences was .

Definition. A rate is achievable if there is a sequence of codes whose maximal probability of error tends to as .

Achievable means: we can communicate at this rate as reliably as we want, provided we are willing to use long blocks.

Definition. The (operational) capacity of a channel is the supremum of all achievable rates, that is, the largest rate that achievable rates can approach.

Now both capacities are on the table: the formula from Section 1, and the largest achievable rate just defined. The rest of the note shows that they are equal.

What repetition suggests, and why it is misleading. With repetition codes, the error goes to zero only if we repeat more and more, and then the rate goes to zero as well. This suggests an unavoidable trade: perfect reliability costs all of the rate. The channel coding theorem says this is false. For the BSC with , any rate below is achievable. We can have error as small as we like while more than half of what we send is message.

Error probability against rate for a bit-flipping channel with flip probability 0.1. Repetition codes lower the error only by lowering the rate toward zero, while Shannon's theorem allows any rate below the capacity of about 0.53 with arbitrarily small error.

Each blue point is a repetition code. Moving down (fewer errors) forces us to the left (lower rate). The theorem says the whole shaded region is available: any rate to the left of , with the error as far down as we like.


7. Jointly Typical Sequences

The preview in Section 5 spoke of an output “falling in the cloud” of an input sequence. To turn that into a decoding rule we need a precise test for whether an input sequence and an output sequence belong together. The test is joint typicality. Roughly, we will decode a received as message if the codeword is jointly typical with . This section defines the test and answers two questions: how likely is a pair to pass when the input really caused the output, and how likely when it did not?

7.1 The definition

Recall from the AEP that a sequence is typical when its probability is close to . Equivalently, its empirical entropy , the surprise per symbol, is close to . Joint typicality asks for this three times.

Definition. Fix a joint distribution and a small . A pair of sequences is jointly typical if where . The set of all jointly typical pairs is written .

In words: looks like a typical input, looks like a typical output, and the two together look like a typical input-output pair. The third condition is the important one. It says that matches position by position in the way the channel would produce. In the picture of Section 5, it says that lies in the cloud of .

7.2 The joint AEP

Theorem (joint AEP). Let be sequences of length drawn i.i.d. from . Then:

  1. as .
  2. .
  3. If and are drawn independently of each other, with the same individual distributions as and , then

What it means. Each part answers a question about the test.

  • Part 1: does a true pair pass? Yes, almost always. A codeword and the output it actually produced are drawn from , so they are jointly typical with probability close to .
  • Part 2: how many pairs pass? About .
  • Part 3: does an unrelated pair pass? Almost never. If had nothing to do with producing , the pair passes with probability only about , which shrinks exponentially in .

Part 3 is the heart of the chapter, and the count behind it is short. There are about typical input sequences and about typical output sequences, so about pairs in which each member looks typical alone. But only of those pairs are jointly typical. The fraction is

So a pair chosen independently hits a jointly typical pair with probability about . The more the output depends on the input (the larger ), the harder it is for an unrelated sequence to pass by luck.

This gives the count of Section 5 a second time. If each unrelated input sequence passes the test with probability , we can try about of them before one is likely to pass by accident. So there is room for about distinguishable codewords.

There is also a view from the receiver’s side. Fix the received sequence . About input sequences are jointly typical with it, out of about typical inputs in total. A randomly chosen input lands among them with probability . The answer is the same.


8. The Channel Coding Theorem

We can now state and prove the central result. It is perhaps the basic theorem of information theory, and it was first stated and essentially proved by Shannon in 1948.

8.1 Statement

Theorem (channel coding theorem). For a discrete memoryless channel with :

Achievability. Every rate is achievable. That is, for every there is a sequence of codes with maximal probability of error .

Converse. Any sequence of codes with must have .

The capacity C is a sharp threshold: rates below C allow arbitrarily small error probability, while rates above C force the error probability up.

The two halves have standard names. Achievability is the positive half: good codes exist below . The converse is the negative half: nothing works above . Together they say that the formula is exactly the largest achievable rate, so the information capacity equals the operational capacity.

Capacity is therefore a sharp threshold. Below , the error can be made as small as we like by using longer blocks, without lowering the rate. Above , the error probability stays above some fixed positive number, however clever the code.

This section proves achievability. Section 9 proves the converse.

8.2 Why the result is surprising

The theorem goes against intuition. If the channel introduces errors, how can we correct them all? Anything extra that we send to correct the errors passes through the same channel and is damaged too, and whatever we send to correct that is damaged again, without end.

Shannon’s way out rests on three ideas. Each one relaxes the problem a little.

  1. Allow a small but nonzero probability of error. We do not ask for zero errors. We ask for an error probability below any target we name, such as one in a billion.
  2. Use the channel many times in a row. Over a long block the law of large numbers takes effect, and the noise becomes predictable in bulk. A BSC with flips about of a long block, and almost never . We do not know which bits flip, but we know roughly how many.
  3. Choose the code at random, and average. We do not design a clever code. We pick the codewords by chance and compute the error probability averaged over all such choices. If the average is small, at least one particular code must be good.

8.3 The idea of the proof

The proof puts the three ideas together with one decoding rule, jointly typical decoding: the receiver looks for a codeword that is jointly typical with the received sequence. If exactly one codeword passes the test, the receiver declares it to be the one that was sent.

Why this works follows directly from the joint AEP.

  • The codeword that was sent and the received sequence are a true input-output pair. By part 1 they are jointly typical with high probability. So the right codeword passes.
  • Any other codeword was chosen independently of the one that was sent, so it is independent of the received sequence. By part 3 it passes with probability only about .
  • There are codewords. The chance that any wrong one passes is at most about

which goes to zero as grows, exactly when .

That is the whole argument. The rate counts how many wrong codewords there are. The mutual information controls how unlikely it is for each of them to pass. Reliable communication is possible as long as the first number is smaller than the second. Choosing the input distribution that maximizes makes this work for every .

Jointly typical decoding is not the best possible decoder. The best one picks the most likely message given the output (maximum likelihood decoding). But jointly typical decoding is easy to analyze, and it is already good enough to achieve every rate below capacity.

8.4 What the proof does and does not give

Random coding is the method of proof, not a method of signaling. Codes are chosen at random only to make the mathematics symmetric and to show that a good code exists. Once we know one exists, sender and receiver can simply agree in advance to use the best code, which could in principle be found by exhaustive search.

The theorem does not tell us how to build a practical code. A randomly generated codebook is likely to be good, but it has no structure. Decoding it means searching a table with entries, which is exponentially large. Ever since Shannon’s paper, researchers have looked for structured codes that are easy to encode and decode and still come close to capacity. Section 10 describes the simplest example, the Hamming code.


9. The Converse

The converse says that no code can beat capacity: if the error goes to zero, the rate is at most . The argument is easiest to follow when no errors at all are allowed, so we start there.

9.1 Zero-error codes

Suppose a code makes no errors at all: the decoder’s guess equals the message with probability . Let the message be uniform over its values, so . Since the receiver recovers exactly from , nothing about is uncertain once is known: . Then

Each step has a plain meaning.

  • (a) is the data processing inequality. is a Markov chain, because the output depends on the message only through the codeword. So the output cannot know more about the message than it knows about the codeword.
  • (b) says that uses of a memoryless channel carry at most the sum of what each single use carries. It is proved in the box below.
  • (c) holds because each single use carries at most , by the definition of .

Dividing by gives .

Read as a whole, the chain is bookkeeping about bits. The message contains bits. All of them must reach the receiver. But uses of the channel can deliver at most bits. So .

9.2 Fano’s inequality and the general converse

Now allow a small probability of error instead of zero. Only one thing changes in the chain above: is no longer exactly zero. This is where Fano’s inequality comes in. It says that if the decoder is rarely wrong, the remaining uncertainty about the message is still small:

Repeating the chain with this term in place of ,

Dividing by ,

If as , the first two terms on the right vanish, leaving . This proves the converse. (The theorem is stated for the maximal error , but , so forces .)

The same inequality, rearranged, gives a lower bound on the error of any code:

What it means. If , the message holds more bits than the channel can deliver, and the missing fraction shows up as errors. For large the error probability is at least about , which is a fixed positive number. We say it is bounded away from zero. At a rate of twice the capacity, for example, the decoder is wrong at least about half the time.

This result is called the weak converse. A strong converse also holds: above capacity the error probability does not merely stay positive, it goes to exponentially fast as grows. So capacity is a very sharp dividing line. Below it, the error can be driven to . Above it, the error is driven to . That is the curve drawn in the figure of Section 8.1.

9.3 Equality in the converse: what a good code looks like

The converse is a chain of inequalities. A code that operates at capacity must make every one of them hold with (almost) equality. Reading off what each equality requires tells us what such a code must look like.

  • Equality in (a), data processing, requires that the codewords are all distinct and that the decoder’s output keeps everything the received sequence says about the message.
  • Equality in (b) requires , which holds only if the output symbols are independent of each other.
  • Equality in (c) requires , which holds only if each position of the codebook uses the input symbols with the capacity-achieving frequencies .

So to an observer who does not know the codebook, the output of a capacity-achieving code looks like i.i.d. noise drawn from

the output distribution that produces. The output looks completely random, even though it is carrying a message.

We can check this on two examples.

  1. Noisy typewriter. The code that uses every other key has 13 codewords of block length 1 and achieves capacity . If the 13 keys are used equally often, the printed letter is uniform over all 26 letters, as predicted.
  2. Binary symmetric channel. Any input sequence can turn into any output sequence with positive probability, so no two codewords can be told apart with zero error. A zero-error code does not exist here. Still, the conclusion carries over: the output of a good code looks like i.i.d. fair coin flips. And in the cloud picture of Section 5, at rates close to capacity the clouds (the decoding sets of the codewords) cover almost all of the possible output sequences, with almost no gaps. Above capacity there is no room left, the clouds must overlap, and the error can no longer be made small.

10. Hamming Codes

The channel coding theorem promises good codes but does not hand us one. A useful code must not only have a low error probability. It must also be simple enough to encode and decode efficiently. The search for such codes created the field of coding theory. This section describes its simplest result, the Hamming code, which shows the basic idea behind most codes.

Repetition. The purpose of coding is to add redundancy, so that the message can be recovered even if part of what was sent is corrupted. The most obvious way is to repeat. To send a , send . To send a , send . The receiver takes a majority vote, and is wrong only if three or more of the five bits are flipped. This uses five symbols to send one bit, so the rate is . Longer repetition codes make the error as small as we like, but the rate goes to zero as well. The code is simple, but not useful.

Parity checks. We can do better by combining bits in a smarter way, so that each extra bit checks for an error in some group of message bits. The parity of a group of bits says whether it contains an even or an odd number of s. Take a block of message bits and choose one extra bit so that the whole block has an even number of s. If one bit is flipped on the way (or any odd number), the receiver sees an odd count and knows something went wrong. This code detects an error. It cannot say where the error is, so it cannot correct it, and it misses an even number of errors altogether.

The Hamming code. The next step is to use several parity checks, each covering a different subset of the message bits. The Hamming (7,4) code uses three check bits that cover overlapping groups of four message bits. It is easiest to see with a picture. Draw three overlapping circles. They have four regions where circles overlap and three outer regions. Put the four message bits in the overlaps. Then put a check bit in each outer region, chosen so that every circle contains an even number of s.

The Hamming (7,4) code drawn as three overlapping circles. Left: message 1011 with check bits 010 so that every circle has an even number of ones. Right: after one bit is flipped, circles A and C have odd parity and B is even, which identifies the flipped bit.

Decoding. The receiver recomputes the parity of each circle. If one bit was flipped, exactly the circles that contain that bit become odd. Each of the seven positions lies in a different combination of circles, so the pattern of odd circles points to exactly one bit. The receiver flips it back.

In the figure, circles A and C are odd and B is even. The only bit that lies in A and C but not in B is , so is the one that was flipped.

The code has codewords of block length , so its rate is , and it corrects any single error in a block.

Why it works, in the language of this note. Any two of the 16 codewords differ in at least 3 positions. The smallest such number is called the minimum distance of the code, so here the minimum distance is 3. It measures how far apart the codewords are, and therefore how well they can be told apart at the output. If a codeword is corrupted in one position, it still differs from every other codeword in at least two positions, so it is closer to the true codeword than to any other.

In the cloud picture: the cloud of a codeword is the codeword itself plus its 7 one-flip neighbours, 8 words in total. The 16 clouds do not overlap, and

so they fill the space of all 7-bit words exactly, with nothing wasted. This is the packing of Section 5 in miniature.

How good is it? Take a BSC with and send 4 message bits.

SchemeRateProbability that the 4 bits arrive wrong
No coding
Repeat each bit 3 times
Hamming (7,4)

The Hamming code gives about the same protection as repetition while sending far less redundancy. The capacity of this channel is , so in principle much better is possible.

Toward capacity. A Hamming code fixes only one error per block, and a long block is likely to contain more than one. Later codes (Reed-Solomon, BCH) correct several errors per block. Still, to reach capacity on a BSC, a code must correct about errors in a block of bits while keeping about of them as message bits, and for decades no practical code came close. Turbo codes (1993) and low-density parity check (LDPC) codes finally did. Both are decoded iteratively: decoders pass their “opinions” about each bit back and forth until they agree. They are used in mobile networks, WiFi and satellite links.


11. Feedback Capacity

Suppose every received symbol is sent back to the sender, immediately and without error. The sender can then choose the next input using both the message and everything received so far, . Can we do better with this feedback?

A communication system with feedback: the channel output is sent back to the encoder, which sees all past outputs before choosing the next input.

Write for the capacity with feedback: the largest rate achievable by codes that are allowed to use it. The surprising answer is that feedback does not help.

Theorem (feedback capacity). For a discrete memoryless channel, .

What it means. The noise in a memoryless channel is fresh on every use. Knowing how the past symbols were corrupted says nothing about how the next one will be corrupted, so the sender cannot use that knowledge to push more bits through each use. Every channel use still delivers at most bits, with or without feedback.

What feedback can do is tell the sender what the receiver is still missing. That makes the job much simpler, without changing how much can be sent. The erasure channel of Section 2.5 is the example: with feedback, resending each erased bit until it gets through achieves rate with no clever code at all.

HW4 Problem 7: BSC with feedback (book Problem 7.33)

Suppose that feedback is used on a binary symmetric channel with parameter . Each time a is received, it becomes the next transmission. Thus is Bernoulli(), , , …, .

(a) Find .

(b) Show that for some values of , this can be higher than capacity.

(c) Using this feedback transmission scheme, , what is the asymptotic communication rate achieved? That is, what is ?


12. Source-Channel Separation

It is time to combine the two main results so far. Data compression says a source can be described with bits per symbol if . Data transmission says bits can be sent reliably at rate if . Is then the exact condition for sending a source over a channel?

To make the question precise: a source (speech, text, video) produces symbols with entropy rate , meaning that on average each symbol carries bits of information (see entropy rates). We want to send them over a channel with capacity bits per use, using one channel use per source symbol, so that the receiver can reconstruct the sequence.

There are two ways to design such a system.

  • One stage. Map the source sequence directly to channel inputs, with a single code designed for this particular source and this particular channel.
  • Two stages. First compress the source into bits in the most efficient way, ignoring the channel. Then send those bits with a channel code, ignoring where the bits came from.

The two-stage design is much simpler. But it is not clear that it loses nothing, because the compression is designed without knowing the channel and the channel code without knowing the source. The theorem says nothing is lost.

Theorem (source-channel coding theorem). If a source satisfies the AEP and its entropy rate satisfies , it can be sent over the channel with probability of error going to zero. Conversely, if , the probability of error is bounded away from zero, whatever scheme is used.

What it means. is how many bits per symbol the source produces. is how many bits per use the channel can deliver. The source fits through the channel exactly when it produces less than the channel can carry. No other property of the source or the channel matters.

Just as important, the simple two-stage design is as good as any design whatsoever:

  1. Compress. Squeeze source symbols down to about bits.
  2. Protect. Send those bits with a channel code whose rate is just above and below .

Separate source and channel coding: a source encoder compresses the data to bits, a channel encoder adds redundancy, the noisy channel corrupts the signal, a channel decoder recovers the bits, and a source decoder decompresses. The source code depends only on the source and the channel code only on the channel.

So compression and error protection can be engineered separately, with bits as the common interface between them. This is how modern systems are built. A source coder (JPEG, H.265, Opus) compresses data without knowing which channel it will travel over. A channel coder (LDPC or polar codes in WiFi and 5G) protects bits without knowing what they represent. The same network can carry speech, video and files, because all of them are just bits.

With this result the two basic theorems of information theory are tied together, and each can be summed up in a sentence. Compression works because of the AEP: a source has only about likely sequences, so bits per symbol are enough to name one. Transmission works because of the joint AEP: the channel output is very likely to be jointly typical with the codeword that was sent, while any other codeword is jointly typical with it only with probability about , so about codewords can be used and still told apart.


13. Further Problems

13.1 Processing the output cannot help

HW4 Problem 2: Preprocessing the output (book Problem 7.1)

One is given a communication channel with transition probabilities and channel capacity . A helpful statistician preprocesses the output by forming . He claims that this will strictly improve the capacity.

(a) Show that he is wrong.

(b) Under what conditions does he not strictly decrease the capacity?

13.2 Noise with memory

HW4 Problem 5: Channels with memory have higher capacity (book Problem 7.3)

Consider a binary symmetric channel with , where is addition modulo 2 and . Suppose that the noise bits have constant marginal probabilities , but that are not necessarily independent. Assume that is independent of the input . Let . Show that

13.3 Binary multiplier channel

HW4 Problem 6: Binary multiplier channel (book Problem 7.23)

(a) Consider the channel , where and are independent binary random variables that take on values and . is Bernoulli(), that is, . Find the capacity of this channel and the maximizing distribution on .

(b) Now suppose that the receiver can observe as well as . What is the capacity?

13.4 Joint typicality for three variables

HW4 Problem 8: Joint typicality for three variables

Let be i.i.d. according to . The empirical entropy of a sequence is , its surprise per symbol. We say that is jointly typical, written , if the empirical entropies of all seven combinations (, , , the three pairs, and the triple) are within of their true values. For example,

Now suppose that is drawn according to . That is, the three sequences have the same marginals as but are independent. Find (bounds on) in terms of the entropies , , , , , and .


Summary

ConceptStatement
The problemDifferent inputs can produce the same output. Use only inputs that cannot be confused.
Channel capacity, and also the largest achievable rate
Recipe: find the noise term, then maximize the output entropy
BSC
BEC
Z-channel (flip probability ), at
Weakly symmetric channel, uniform input
Properties; is continuous and concave in
Rate of a code message bits per channel use, so
Joint AEPtrue pair: jointly typical with probability ; independent pair: about
Achievability codes exist with error
Converseerror ; in general
Feedback for DMCs
Source-channel separationreliable if , impossible if

The main ideas in one paragraph: capacity is the logarithm of the number of distinguishable inputs, per channel use. Noise spreads each codeword into a cloud of about possible outputs. Reliable decoding needs non-overlapping clouds, and about of them fit among the typical outputs. Random coding with jointly typical decoding shows that this many can actually be packed, and Fano’s inequality shows that no code can pack more. The best input distribution turns into the capacity .