Entropy and Information Measures

On this page

When a message arrives, which possibilities does it rule out? What remains unknown? Information theory makes this change measurable. It measures uncertainty under a probability model, rather than directly measuring a statement’s meaning, truth, or usefulness.

We will follow three processes: replies eliminating candidates, individual information contributions forming an average, and one variable helping us understand another. All logarithms use base 2 and the unit is the bit. Unless stated otherwise, variables are finite and discrete.

From eight candidates to one answer

Let take a value from to , each equally likely. You may ask yes-or-no questions and must eventually identify the answer.

“Is it greater than 4?” eliminates half the candidates regardless of the reply. Continue dividing in half and the candidate count follows . The sequence below follows the fixed answer ; every other answer also takes exactly three questions.

Preparing the visual
How one answer becomes 3 bits of information

Eight equally likely candidates become four, two, then one along this answer path. Each question halves the remaining probability mass and contributes 1 bit. These are logical steps, not physical time.

The information in a reply depends on how much probability mass it eliminates. Here each reply has conditional probability at the time it is received, so each contributes bit. The total is bits.

This relies on equal probabilities and equal splits. Suppose instead that has probability , while each other number has probability . Asking “Is it 7?” first lets most cases finish immediately. “Yes” and “no” now carry approximately and bits respectively. A yes-or-no question does not imply that every reply carries exactly 1 bit.

Self-information: how much does confirming an event tell us?

For an outcome with probability , its self-information is:

The rarer the event, the more information confirming it provides. An event with probability has zero self-information: the model already determines its outcome.

Probability in the modelSelf-informationInterpretation
bitResolve two equally likely alternatives
bitsIdentify one of eight equally likely candidates
About bitsA rarer event provides more information
bitsThe outcome is already certain

Why a logarithm? Independent event probabilities multiply, while we want their information to add:

Without independence, information still adds, but the second term must use the conditional probability:

Self-information can be fractional. This does not mean we literally asked questions, or that a standalone binary codeword can have a fractional length. We will distinguish these quantities below.

Entropy: weight each outcome’s information by its probability

Self-information describes one outcome. Entropy describes the distribution: it is expected self-information.

Imagine repeatedly drawing independent samples from the same distribution. Common outcomes enter the average more often. Rare outcomes may carry more information individually, but occur less often. We must therefore multiply each information value by its probability before summing.

Consider two outcomes with and . Their entropy is the binary entropy function:

First, look across the full probability range: the horizontal coordinate is , and the vertical coordinate is the sum of the two contributions, .

h₂(p) 1 0 0.5 1 p 1 bit

At either endpoint the outcome is certain and entropy is zero. An even split is hardest to predict and gives 1 bit. The curve is symmetric because renaming the outcomes cannot change uncertainty.

Next, unpack one point on this curve. Change the probability and inspect each rectangle’s width, height, and area to see how the two contributions add up.

Preparing the visual
Rarer means taller—and narrower

Drag the probability of A. The blue and gold rectangles change together: width is probability, height is self-information, and area is the contribution to entropy. Adding both areas gives the average information.

At , each outcome has bit of self-information and contributes bits after weighting. Entropy is maximal at bit. Moving toward either endpoint makes the rare outcome more surprising, while lowering average uncertainty. At or , the outcome is certain and entropy is zero.

The convention follows from . A zero-probability event never happens within the model. If it occurs in reality, reconsider the model instead of treating it as an ordinary finite-information observation.

Entropy is not the actual number of questions

Self-information and entropy can be fractional, while an actual yes/no question counts as one question. Optimal symbol-by-symbol prefix coding satisfies for at least two positive-probability outcomes. Self-information, entropy, average code length, and worst-case question count are different quantities.

Keep that distinction here. The fair-die decision tree, rounding overhead, and block coding belong in Source Coding and Compression.

Joint entropy, conditional entropy, and mutual information

With two variables, ask: after seeing a clue, how much is still unknown? To expose the averaging, use a nonuniform : and . The clue is , with independent noise flipping the value with probability .

Initially . Observing can mean that rare survived, or that common flipped. Both joint probabilities are , so this branch becomes evenly split. What happens in the other branch, and how should we average them?

Preparing the visual
Different branches: how does conditional entropy average?

Split the joint probabilities by X and normalize each row. Weight each branch entropy by its probability to obtain conditional entropy. One branch can increase uncertainty while the average decreases.

Conditional entropy: weight every clue by its probability

Divide each table row by its own sum to get , the distribution after one particular observation. Conditional entropy averages the branch entropies using the probabilities of those observations:

Initially occurs with probability and has 1-bit entropy. occurs with probability and has about bits. Their weighted mean is about bits. Neither an unweighted average nor a single branch gives this answer.

Switch to a uniform prior and the rows become symmetric: both branch entropies are . Computing just one row happens to give the correct average in that special case, but not in general.

Joint entropy: determine the clue, then the original value

Treat as one outcome, with entropy . Alternatively, determine first, then determine within its branch. This gives the chain rule:

The row sums on the right form and determine the first term. The weighted branch entropies determine the second. These are the two contributions shown in the joint-entropy readout.

Algebraically, start with , take negative logarithms, then average over the joint law. When the variables are independent, , and joint entropy equals the sum of marginal entropies.

Mutual information: how much uncertainty disappears on average?

Before observing the clue, uncertainty is . Afterwards, the average remainder is . Their difference is mutual information:

Initially the prior has about bits, and the conditional average is about bits, giving bits of mutual information. Although one observation can raise uncertainty to 1 bit, averaging over all clues still reduces it.

Mutual information is symmetric, nonnegative, and zero exactly when the variables are independent. Thus , without requiring every individual branch to obey that same inequality.

At , the clue is independent and mutual information is zero. At or , it determines the original value completely and mutual information equals . Opposite values can convey complete information. Statistical dependence requires neither identical values nor a causal relation.

Compare the information measures in one diagram

For the two finite discrete variables considered here, a Venn diagram helps organize the identities: the circles represent and , their overlap represents , and their union represents . Areas are schematic; they do not show the numerical values for a particular noise setting above.

H(X) H(Y) H(X|Y) H(Y|X) I(X;Y) H(X,Y)

The left circle gives . Adding the three non-overlapping regions gives the joint entropy. The diagram puts these relationships together for reference.

Put the measures side by side

MeasureObjectQuestion
One observed outcomeHow much information does confirming it provide?
One variable’s distributionHow much uncertainty is there on average?
A joint distributionHow uncertain is the pair?
Conditional distributions, averaged over cluesHow much remains after learning X?
Dependence between variablesHow much does learning X remove on average?

Two useful bounds for finite discrete variables are:

  • , with equality only for a certain outcome.
  • For an alphabet of size , , with equality only when those outcomes are equally likely.

Alphabet size constrains maximum entropy; the probability distribution determines actual entropy. For sequences, context also matters. Individual letter frequencies and the distribution of the next letter given preceding text are different objects. Their difference cannot be attributed entirely to unequal letter frequencies.

The foundation ends here; explore further when needed

The table is enough preparation for the next chapter. Sequence chain rules and entropy rates appear in Chapter 3. Densities, differential entropy, and coordinate scaling are introduced with Gaussian channels in Chapter 4.

For why conditions change dependence and what processing discards, read Optional: Conditional Information and Data Processing. Conditional groups and merged states explain these separately, without making them prerequisites for the main sequence.

Next: what does an inaccurate predictive distribution cost?

So far we have calculated information using the given distribution itself. Next we distinguish the true data distribution from the distribution used to predict or encode it, introducing Cross-Entropy and KL Divergence.

The series then covers lossless compression, noisy channels, compression allowing distortion, and language models.

References

  • Claude E. Shannon, A Mathematical Theory of Communication, 1948: discrete sources, entropy, conditional entropy, and coding.
  • David J. C. MacKay, Information Theory, Inference, and Learning Algorithms: Chapter 2 on probability and entropy; Chapters 4–5 on source coding.
  • Thomas M. Cover and Joy A. Thomas, Elements of Information Theory, 2nd edition: Chapter 2 on information measures and data processing; Chapter 5 on lossless coding; Chapter 8 on differential entropy.