Information Theory
How much information is in a message, how compactly it can be written, and how fast it can be sent through noise. Drag a distribution and watch its entropy, decompose a joint law into information diagrams, guess against the maximum entropy principle, push bits through a noisy channel, watch a Huffman code being built, and find the capacity of a Gaussian channel.
Follows D. Applebaum, Probability and Information: An Integrated Approach, 2nd ed. (Cambridge University Press, 2008): Chapter 6 (information and entropy), Chapter 7 (communication), §8.7 (entropy in the continuous case), §§9.6–9.7 (conditional entropy, mutual information and channel capacity for densities) and §10.6 (entropy rates). The probability chapters of the same book are on the Probability page. Chapter and exercise numbers refer to that book; the questions and examples here are written for this page. For how this subject connects to the others, see the roadmap.
Information and entropy
A rare event is more informative than a common one. Entropy is the average information in the outcome of a random variable: how many yes/no questions, on average, it takes to pin down the outcome. Drag the bars below and find the shapes with the most and the least entropy.
The idea
It depends only on the probabilities, not on the values takes. For a Bernoulli variable, , which is 1 bit at .
with chosen to give the right mean. It is the "least committal" law consistent with what you know. In statistical mechanics the are energies and this is the Boltzmann distribution.
Explore
Worked example
Three fair coins are tossed. Let be the number of heads.
Write down the law of .
and .
How much information is there in learning ? In learning ?
bits, and bits.
Compute .
The full outcome (e.g. HTH) has 3 bits of entropy. Where did the other 1.19 bits go?
The full outcome is uniform on 8 sequences, so it has bits. is a function of it and forgets the order of the heads, which is why . In general : processing can only lose information. The missing bits is the average information in "which order", given the count.
Check your understanding
Which law on four outcomes has more entropy: or ?
- The first, because it is uniform.It is uniform only on two of the four outcomes, which gives bit.
- The second
- They are equal.Compute both: one is exactly 1 bit.
takes values . Let . How does compare with ?
- That is how the variance would scale (by , in fact). Entropy only sees the probabilities.
- , since is more spread out.Entropy does not measure spread of values; relabelling the outcomes changes nothing.
Among all laws on with mean 3.5, which has the largest entropy?
- The uniform law
- It has mean 3.5 but only 1 bit of entropy. Try it in the explorer.
- A Gibbs law with With the weights favour small values, so the mean is below 3.5.
Practice
The Bernoulli entropyA calculus check
Show that has its maximum at and is symmetric about it. Compute .
Solution
by its formula. In natural logs, , which is positive for , zero at and negative after. So the maximum is bit. bits.
Why uniform is the maximumThe Gibbs inequality
Using (equality only at ), show that , with equality only for the uniform law.
Hint
Look at , summing over the with .
Solution
In natural logs, . Equality needs for every with , and needs every to have ; that is the uniform law. Dividing by converts to bits.
From Applebaum, Probability and Information: An Integrated Approach (2nd ed., Cambridge, 2008)
Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.
Exercise 6.5Two entropies
Find the entropy of (a) the number of heads in two tosses of a fair coin; (b) a Poisson variable with mean .
Hint
(b) has infinitely many terms, but they shrink fast; sum the first several.
Solution
(a) The distribution is , so bits.
(b) : . Summing gives bits (the terms beyond contribute less than ).
Exercise 6.6The binary entropy function
For : (a) show ; (b) show ; (c) show the maximum is at and sketch the graph.
Hint
Use the convention (the limit of ). For (c), differentiate.
Solution
(a) Both terms vanish at and , using .
(b) Replacing by swaps the two terms, and .
(c) , which is positive for , zero at , negative after. So rises from to its maximum bit and falls back symmetrically; it is concave () with vertical tangents at the ends.
Exercise 6.13Maximum entropy with a mean constraint
Three states have energies 1, 2 and 3 J and the mean energy is 2.4 J. (a) Find the maximum-entropy distribution. (b) Find the corresponding temperature and comment.
Hint
The maximiser is a Gibbs distribution ; choose to match the mean. Temperature is .
Solution
(a) . With , the mean condition becomes , i.e. , so and . Then .
(b) K. The temperature is negative: the mean energy is above the uniform-distribution value , so higher energies must be more likely, which a Gibbs distribution can only do with . Negative temperatures do occur in systems with bounded energy (population inversion in lasers); the huge magnitude is because the energies are joules rather than atomic scales.
Exercise 6.16Evening out a distribution raises entropy
Replace two probabilities by and , where . Prove the entropy increases.
Hint
Only two terms change. Differentiate in .
Solution
Let . Then , which is positive as long as , i.e. . So is strictly increasing on and . The other terms of the entropy are unchanged.
Joint entropy and mutual information
How much does knowing tell you about ? Mutual information answers in bits: it is the drop in uncertainty about once is known. Reshape a joint law by dragging the dividers of the mosaic below and watch the entropies add up.
The idea
is the entropy of the conditional law of given , and is its average over . (The book writes .)
Explore
Worked example
and take values 0 and 1 with joint law , , , .
Find the marginal laws and their entropies.
, , so . , so .
Find .
bits.
Compute from its definition, and check the chain rule.
Given , is 0 or 1 with probabilities , so . Given , for certain, so . Then , and indeed .
Find two ways.
, and bits. Set the mosaic to these numbers (, , ) to check.
Check your understanding
. What can you conclude?
- and are independent.
- is a function of .Then and , the largest it can be.
- One of them is constant.That is enough for but not necessary. In the mosaic, line the two horizontal dividers up.
is a fair bit and . What is ?
- 0 tells you exactly. That is the opposite of independence.
- 1 bit
- 2 bitsThat is . But , not 0, so subtract it.
Which of these always holds?
- for every value Try "Y depends on X only sometimes": a rare value of after which is a fair coin.
- The inequality goes the other way: .
Practice
Two formulas for IExpanding the logarithm
Show that , where , are the marginals.
Solution
Split the logarithm: . The first sum is . In the second, summing over first gives ; similarly the third is . So the total is .
The last bitA function of a random variable
is uniform on and . Find , , , and .
Solution
, . is determined by , so . Given , is uniform on two values, so . Then bit, and the chain rule checks: .
From Applebaum, Probability and Information: An Integrated Approach (2nd ed., Cambridge, 2008)
Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.
Exercise 6.8Entropies of a pair of bits
is Bernoulli with , and , . Compute , , , and .
Hint
Build the joint table first, then everything follows from .
Solution
Joint probabilities: , , , . So , . In bits:
(a) . With : (b) . (c) . (d) . (e) .
Exercise 6.10Conditioning can only reduce entropy
Using Gibbs' inequality, show , with equality iff are independent. Deduce .
Hint
Write as one sum over the joint distribution.
Solution
Gibbs' inequality for probability vectors , applied with and , shows this is , with equality iff for all : independence. Since , with the same equality case.
The maximum entropy principle
With no information about a die, you assume every face is equally likely. Now suppose you are told only that its average roll is 4.5. Which probabilities should you assume? Pick the ones with the most entropy: the least committal law that still agrees with what you know.
The idea
The uniform law has the largest entropy among all laws on outcomes, . So the old principle of symmetry (“with no reason to prefer an outcome, treat them equally”) can be restated as: choose the law of maximum entropy. The restatement is more powerful, because it still makes sense when you do have partial information.
Knowing only the mean. Let take values with known. Maximize subject to and . With Lagrange multipliers ,
Physics. If the are the energies of the particles in a gas and the average energy is fixed, the same calculation gives Boltzmann's law, with (Applebaum §6.5): the maximum-entropy law at a given temperature.
Explore
Worked example
Jaynes's dice problem (the “Brandeis dice”): a die has average roll 4.5. Find the maximum-entropy law.
Write down the form of the answer.
for , with and : a geometric progression.
Which equation determines ? Is above or below 1?
. The mean 4.5 is above the fair value 3.5, so the weights must increase: . Solving numerically gives ().
Give the law and its entropy, and compare with another law of mean 4.5.
, with bits (the fair die has ). The law “4 or 5, each with probability ” also has mean 4.5, but only 1 bit of entropy: it claims to know much more than we were told.
Check your understanding
You know only that a die's mean is 3.5. The maximum-entropy law is:
- Uniform: 3.5 is the fair die's mean, so the constraint adds nothing, and .
- Half the mass on 3 and half on 4.Mean 3.5, but only 1 bit of entropy: it assumes far more than you know.
In a Gibbs law on , the ratio is:
- The same for every , namely .
- Proportional to . with equally spaced gives a geometric progression.
Why is the maximum-entropy law a sensible default, rather than any other law with the right mean?
- Any other law with the same mean has less entropy, so it encodes information you were not given.
- It is the law the die actually has.Nothing guarantees that. It is the best guess given what you know, not the truth.
Practice
Two outcomesThe smallest case
takes values 0 and 1, and . What does the maximum-entropy principle give, and why is there nothing to maximize?
Solution
, : the two constraints already determine the law. The Gibbs form agrees: with .
The constraint at workLagrange in full
Using natural logarithms, solve for , and show that is fixed by normalization.
Solution
, so . Summing to 1 gives . (Base-2 logarithms only rescale and , as in Applebaum's .) The second-derivative matrix is , negative definite, so this critical point is the maximum.
Why e to the score: softmax
Classifiers, attention in language models, Boltzmann exploration in reinforcement learning and the Exp3 algorithm for adversarial bandits all turn real-valued scores into probabilities the same way: exponentiate, then normalize. Scores can be negative, so some positive transformation is needed, but why the exponential? Because the result is the maximum-entropy distribution of the previous module. The base itself turns out to be a choice of units.
The idea
Proof in one line. Write for softmax, so . Substitute:
where is the Kullback–Leibler divergence, zero only for (Gibbs' inequality). So every other distribution falls short of softmax by exactly times its divergence from it.What that means. Putting all the probability on the highest score maximizes the expected score but commits completely. The uniform law hedges completely but ignores the scores. Softmax is the law that is as uncertain as possible for the expected score it achieves; the temperature sets the exchange rate. As it becomes the argmax; as , the uniform law.
Where it shows up. The final layer of a classifier (multinomial logistic regression). Attention, , where dividing by is a temperature: the dot product of two -dimensional vectors with independent unit-variance entries has variance , and the scaling keeps the scores at variance about 1 so the softmax is neither nearly one-hot nor nearly uniform. Boltzmann (softmax) exploration in reinforcement learning. And Hedge/Exp3 for adversarial bandits, which put weight on arm with its total reward so far: by the theorem above, that is the law maximizing , an entropy-regularized “follow the leader” that never commits completely.
The same formula in economics. In discrete-choice models, a person picks option with value , and the multinomial logit is the standard model of their choice probabilities. It is the theorem above with : logit maximizes over the simplex, a concave objective, so a convex program with a unique solution. The entropy term has two readings: a value placed on variety (not committing to one option), or, in rational-inattention models, the cost of the information needed to tell the options apart (see M. Fosgerau, E. Melo, A. de Palma and M. Shum, “Discrete choice and rational inattention: a general equivalence result”, International Economic Review, 2020). A third route reaches the same formula without entropy: McFadden's random utility model, in the last practice problem below.
Explore
Worked example
Scores , temperature .
Compute the softmax probabilities.
, , , so and . Each step down in score divides the probability by .
Check that .
Expected score ; entropy nats; total , and .
Compare two other laws: all mass on the top score, and uniform.
One-hot: . Uniform: . Both are below ; the shortfalls are , the divergences from softmax.
Change the temperature to and .
: , sharper. : , flatter. Doubling all the scores has the same effect as halving : only matters.
Check your understanding
You add 5 to every score before a softmax. The probabilities:
- Don't change: every gets the same factor , which cancels in .
- Move toward the highest score.That is what dividing by a smaller does, not adding a constant.
A softmax with base 2 instead of is:
- The same as an -softmax at temperature times larger.
- A genuinely different family of distributions.: only the scale of the scores changes.
Why does attention divide by ?
- It keeps the scores' spread about constant as the dimension grows, so the softmax's effective temperature doesn't shrink with .
- To make every score positive.Positivity isn't needed: the exponential takes care of that.
Practice
Only the exponentialA functional equation
Let be continuous and suppose that normalizing gives the same probabilities after adding any constant to all the scores. Show .
Hint
With two scores and , invariance says .
Solution
Put . The hint gives for all : Cauchy's multiplicative equation. Then is continuous and additive, , so , and with . Every base is allowed; plays the role of .
The gradient of cross-entropyWhy training is easy
For () and a true class , show that the gradient of with respect to is .
Solution
, so . The update pushes up the true score and pushes down each other score in proportion to its probability. With base 2 the same calculation gives an extra factor .
Gumbel noise gives softmaxMcFadden's random utility
Each option's utility is , with independent standard Gumbel variables (distribution function ). The person picks the option with the largest utility. Show that option is picked with probability .
Hint
Condition on the value of : every other option must come out below . Then substitute .
Solution
With density , . Since with , substituting gives . The expected best utility is (Euler's constant): the log-sum-exp once more. In machine learning the same fact is the “Gumbel-max trick” for sampling from a softmax.
Hedge is entropy-regularizedAdversarial bandits and experts
In the experts problem, after rounds expert has total reward . Hedge plays . Show this is the maximizing , and explain why plain “follow the leader” (put all weight on ) is the limit.
Solution
It is the theorem with scores and . As the entropy term vanishes and the maximizer becomes the argmax. Follow-the-leader can be forced to switch every round by an adversary; the entropy term keeps Hedge's weights changing smoothly, which is what gives it regret against any adversary.
Channels and capacity
A noisy channel garbles some of what is sent. The mutual information between input and output measures how much gets through, and the sender can tune it by choosing how often to send each symbol. The best achievable value is the channel's capacity, and Shannon's theorem says it is a hard speed limit for reliable communication.
The idea
In the binary symmetric channel each bit is flipped with probability , independently. If , then , and whatever was sent, so
with the maximum at , which makes uniform.
Explore
Worked example
In a "Z-channel", a 0 is always received correctly, but a 1 arrives as 0 with probability . Find its capacity and the input law that achieves it.
With , find the law of .
only if a 1 was sent and survived: .
Find .
Given , is certain: entropy 0. Given , is a fair coin: entropy 1. So .
Write as a function of and maximise it.
. Using ,
What is the capacity? What is surprising about the optimal input?
bits, which equals . The best input sends 1 only 40% of the time: since 1s are the unreliable symbol, it pays to use them less. For the symmetric channel the optimum is always , but in general the capacity-achieving input need not be uniform.
Check your understanding
A binary symmetric channel has . What is its capacity?
- 0
- bit, since half the bits arrive correctlyThey do, but the receiver can't tell which half. Set ε to 0.5 and look at the output law.
- 1 bitThat is the capacity of a perfect channel.
A binary symmetric channel flips each bit with probability 0.9. How does its capacity compare with a channel that flips with probability 0.1?
- It is the same.
- It is nearly zero.The receiver can flip every bit back. That turns it into a channel with ε = 0.1.
- It is lower than at ε = 0.5.The capacity is smallest at 0.5. Look at the capacity curve.
Why is the capacity defined as a maximum over input laws?
- The channel's noise is fixed, but the sender can choose how often to use each input symbol.
- Because is the same for every input law, so the maximum is just that value.Move the p slider: changes with the input law.
- To make the capacity independent of the noise.The capacity depends on the noise; for the symmetric channel it is .
Practice
A ternary channelCapacity by symmetry
Inputs and outputs are . Each input arrives as or as , with probability each. Find the capacity.
Hint
does not depend on the input law. Which input law makes as large as possible?
Solution
for each , so . , with equality when is uniform, which happens when is uniform. So bits.
The repetition codeReliable, but slow
Over a binary symmetric channel with , each message bit is sent three times and decoded by majority vote. Find the probability of a decoding error and the rate. How does this compare with what Shannon's theorem allows?
Solution
Decoding fails if at least two of the three copies are flipped: . The rate is bit per use. The capacity is , so Shannon's theorem promises codes with rate up to about 0.53 and error probability as small as we like. Repetition buys reliability by giving up rate, and longer repetition makes the rate tend to 0; good codes avoid this.
From Applebaum, Probability and Information: An Integrated Approach (2nd ed., Cambridge, 2008)
Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.
Exercise 7.1The binary erasure channel
In the binary erasure channel each input bit is received correctly with probability and erased (output E) with probability ; let . Find , , , the mutual information , and the capacity.
Hint
Output or reveals the input; output E reveals nothing, so .
Solution
, , , and , , .
With : , , .
. Given there's no uncertainty; given the uncertainty is . So and . This is maximal at : bits. The fraction of erased bits is simply lost.
Exercise 7.2Output entropy of the binary symmetric channel
For the binary symmetric channel with error probability and , confirm with . Show iff when . Why doesn't the case matter for the capacity?
Hint
.
Solution
, so .
, dividing by .
If , the output is independent of the input: for every , , so whatever is, and the capacity . The maximisation over is trivial, so nothing in the capacity calculation depends on solving .
Exercise 7.5A cascade of two channels
Two binary symmetric channels with error probabilities , are connected in series, with . Compute and and check .
Hint
The cascade is itself a binary symmetric channel with error . For a BSC, .
Solution
, so bits.
The cascade error is , and . So bits.
: passing through a second noisy channel loses information (the data processing inequality).
Prefix codes and Huffman coding
To compress a source, give common symbols short codewords and rare ones long codewords. Entropy is the floor: no code can beat bits per symbol on average. Huffman's algorithm builds the best possible prefix code by repeatedly merging the two least likely symbols. Watch it work.
The idea
exactly when every is a power of . Otherwise the gap can be shrunk by coding blocks of symbols at a time, which gives bits per symbol.
Watch
- Six symbols, sorted by probability. Each one starts as a tree on its own.
- Merge the two least likely trees. The new node's probability is their sum.
- Repeat with the trees that remain: again take the two smallest.
- And again. A merged node is treated exactly like a symbol.
- After this merge only two trees are left.
- The last merge makes the root.
- Label left branches 0 and right branches 1. Each codeword is the path from the root to its symbol. Compare the average length with the entropy.
Worked example
A source emits five symbols with probabilities . Build a Huffman code and compare it with the entropy and with the Shannon–Fano lengths.
Carry out the merges.
. Now the smallest are and : . Then . Finally .
Read off the codeword lengths and the average length.
The symbol of probability 0.4 joins only at the last merge: length 1. The other four sit two merges below the 0.6 node: length 3 each. So bits. One valid code is . Kraft: .
Compute the entropy.
bits. So , with a gap of only about 0.05 bits.
What do the Shannon–Fano lengths give?
Lengths , so bits. It also lies within 1 bit of , as the theorem promises, but Huffman does half a bit better.
Check your understanding
Is there a binary prefix-free code for four symbols with codeword lengths 1, 2, 2, 3?
- Yes, for example 0, 10, 11, 110110 begins with 11, which is another codeword.
- No
- Yes, as long as the shortest word goes to the most likely symbolWhether the lengths are possible doesn't depend on the probabilities at all.
A source has two symbols with probabilities 0.9 and 0.1, so bits. What is the average length of its Huffman code?
- 0.469 bitsCodeword lengths are whole numbers, and each symbol needs at least one bit.
- 1 bit
- Somewhere between 0.469 and 1, depending on the codeWith two symbols the only sensible code is 0 and 1.
For which sources does the Huffman code achieve exactly?
- When every probability is a power of
- When the source is uniformTry three equally likely symbols: , but the best code has lengths 1, 2, 2 and .
- Always, since Huffman codes are optimalOptimal among codes, but codes have whole-number lengths, and usually isn't of that form.
Practice
Coding pairsThe extension of a source
For the source with probabilities 0.9 and 0.1, code pairs of independent symbols. Build the Huffman code for the four pairs and find the average length per original symbol.
Solution
The pairs have probabilities 0.81, 0.09, 0.09, 0.01. Merge , then , then . Lengths: 1, 2, 3, 3, so bits per pair, or 0.645 bits per symbol, against . The bound says blocks of length are within of per symbol.
Likely symbols get short wordsAn exchange argument
Show that in a code of minimal average length, if then .
Solution
Suppose but . Swap the two codewords. The code is still prefix-free, and the average length changes by . So the original code was not minimal.
From Applebaum, Probability and Information: An Integrated Approach (2nd ed., Cambridge, 2008)
Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.
Exercise 7.9A ternary prefix-free code
Show that a prefix-free code over with word lengths exists, and find one.
Hint
Check Kraft's inequality , then assign words greedily from shortest to longest.
Solution
, so such a code exists. One choice:
No word is a prefix of another: after using , the length-2 words start with 1 or 2; after the unused prefixes are ; and so on.
Exercise 7.12Shannon–Fano versus Huffman
A source has probabilities . Find (a) a prefix-free binary code by Shannon–Fano coding, (b) an optimal code by Huffman coding.
Hint
Shannon–Fano: . Huffman: repeatedly merge the two least likely.
Solution
(a) Lengths (e.g. ). A code: , , , , . Mean length .
(b) Merge , then , then . Code: , , , , . Mean length , against entropy bits.
Exercise 7.15Two Huffman codes
(a) For probabilities , show the Huffman procedure can be carried out in two different ways; write down both codes. Is either better? (b) Find the redundancy of the optimal code, where .
Hint
After two merges there is a tie between two nodes of probability .
Solution
(a) Merge , then . Now must be merged with one of two 's: the symbol or the merged node. Either way the remaining two are merged next, then the root.
Merging with the merged node gives, for instance, , , , , , . Merging it with the symbol gives , , , , , . The codewords differ but the length profile is the same, , with . Both are optimal; neither is better.
(b) bits, so and the redundancy is about .
Entropy for densities and the Gaussian channel
Real signals (voltages, waveforms) take continuous values. Entropy carries over to densities only awkwardly, but mutual information carries over cleanly, and with it the capacity of the most important channel in practice: a signal plus Gaussian noise.
The idea
Why it is awkward. Chop the range into bins of width and let be the bin falls in. Then , which goes to as : describing a continuous value exactly takes infinitely many bits. is what remains after subtracting the infinite part, so it is a relative quantity, not an amount of information.
The ratio is the signal-to-noise ratio. Capacity grows only logarithmically in it: quadrupling the power buys one more bit per use, at most.
Explore
Worked example
Three short calculations, in bits.
. Find .
bits. Negative: a density squeezed into an interval shorter than 1 has negative entropy.
are jointly normal with correlation . Find .
bits. It depends only on , not on the variances.
A channel has signal power 15 and Gaussian noise power 1. Find the capacity, and the capacity if the power is doubled.
bits per use. With power 30: bits: doubling the power bought less than half a bit.
Check your understanding
Doubling changes the entropy of a normal random variable by:
- bit.
- A factor of 2.: scaling adds to the logarithm.
As the bin width shrinks, the entropy of the discretized normal:
- Grows without bound, like .
- Converges to .Only does.
For a fixed signal power, which input law gives the Gaussian channel its capacity?
- Uniform, because it spreads the signal evenly.The uniform has less entropy than the normal for the same variance.
- Normal: it makes normal, the variance- law of maximum entropy.
Practice
The normal's entropyA short integral
Show that for .
Solution
. Take expectations: , so .
Noise sets the floorCorollary 9.6
For with independent, explain why , and deduce that if is normal with variance , no input can make exceed .
Solution
Given , is shifted by , and shifting doesn't change entropy, so . Then , by Theorem 8.10 applied to , whose variance is .
Markov chains and entropy rate
A Markov chain forgets everything except where it is now. That one rule makes it settle into an equilibrium from any start, and it makes the information it produces per step easy to compute. Set the two switching probabilities and watch the chain converge.
The idea
the average, under , of the entropies of the rows of . It satisfies , with equality exactly when all the rows are equal, that is, when the are i.i.d.
Explore
Worked example
A particle moves on the states with transition matrix
Starting from 0, what is the law of ?
It is the first row of : .
Find the invariant distribution.
Solve . The first column gives , so ; by symmetry . With : . has all entries positive, so this is the limit from any start.
Compute the entropy rate.
The rows have entropies 1, 1.5 and 1 bits. So bits per step.
Compare with and interpret.
bits. An i.i.d. sequence with the same one-step law would produce 1.5 bits per step; the chain produces only 1.25, because each step is partly predictable from the last. A source like this can be compressed to about 1.25 bits per symbol, but only by a code that uses the previous symbol.
Check your understanding
The two-state chain above has and , with . What is , the long-run fraction of time in state 0?
- A large means the chain leaves 0 quickly, so it should spend less time there, not more.
- , by symmetryThe two states are only symmetric when .
Take : the chain switches state at every step. Starting from 0, does converge?
- Yes, to Starting from 0, the chain is at 0 at every even time and at 1 at every odd time. Set both sliders to 1.
- No, it alternates between 1 and 0, although is invariant.
- No, and there is no invariant distribution.Check .
For a stationary Markov chain with invariant law , which is always true?
- , and conditioning cannot increase entropy on average.
- Only when is independent of . Try .
Practice
A walk around a cycleDoubly stochastic matrices
A particle on the cycle () steps one place clockwise or anticlockwise with probability each. Show that the uniform law is invariant and find the entropy rate. For which does converge?
Solution
Every column of also sums to 1, so . Each row has two entries , so bit per step, while . For even the chain alternates between even and odd states, so for odd and there is no convergence. For odd some power of is positive and the probability tends to .
A sticky chainEntropy rate of two states
Compute , and for the two-state chain with , . Check your answers in the explorer.
Solution
. bits, while bits. The chain stays put most of the time, which makes it more predictable than an i.i.d. sequence spending the same fraction of time in each state.
From Applebaum, Probability and Information: An Integrated Approach (2nd ed., Cambridge, 2008)
Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.
Exercise 10.14Invariant distributions
Decide whether each chain has an invariant distribution and find it: (a) ; (b) ; (c) .
Hint
Solve with . A finite chain always has at least one invariant distribution; all three here are irreducible, so it's unique.
Solution
(a) , so .
(b) Each column sums to (the matrix is doubly stochastic), so the uniform is invariant.
(c) The equations give and . So : .
Exercise 10.23Entropy rates
Compute the entropy rates of the stationary chains in Exercise 10.14.
Hint
Weight the entropy of each row by the invariant probability of that state.
Solution
(a) bits.
(b) Row entropies , , ; averaged uniformly, bits.
(c) Row entropies , , . So bits.
Exercise 10.24Bounds on the entropy rate
For a stationary Markov chain on states, show . When does equality hold?
Hint
is an average of entropies of distributions on points.
Solution
Each lies in , and the are weights summing to 1, so .
iff every row with is deterministic (the chain moves deterministically from every state it visits). iff every row with is uniform; for an irreducible chain this means for all , i.e. i.i.d. uniform symbols.