Information theory begins with a simple question: how much uncertainty is contained in a random variable? From that starting point, we can quantify how uncertainty changes when variables are observed, how different two probability distributions are, and how much information two variables share.

This note develops the core definitions and identities from Sections 2.1-2.5 of Cover and Thomas, using discrete random variables and base-2 logarithms throughout.

Notation convention

Uppercase letters such as , , and denote random variables. Lowercase letters such as , , and denote particular realized values. Calligraphic letters such as denote alphabets, so . We write , , and . When comparing two abstract distributions, we follow the book and use the shorter notation and .


1. Entropy

Let be a discrete random variable with alphabet and probability mass function . Before defining the average uncertainty of , it helps to quantify the information associated with one outcome.

1.1 Surprise of an outcome

The self-information or surprise of observing is

This definition captures three useful intuitions:

  1. A likely event is not very surprising.
  2. A rare event carries more information.
  3. Independent events should contribute additive information.

The third property explains the logarithm. If and are independent, then the joint probability of observing and is , while the information in that joint outcome is

Probability multiplies, but information adds.

1.2 Expected surprise

The entropy of is the expected surprise of its outcome:

We use the convention . Entropy depends only on the probabilities, not on the labels assigned to the outcomes.

Because , every term is nonnegative, so

If the logarithm uses base , entropy is measured in bits. Natural logarithms give nats. See the notation reference for the probability notation used throughout this note.

1.3 Bernoulli entropy

For ,

where denotes the entropy of a Bernoulli random variable with parameter .

  • If or , then is deterministic and .
  • If , both outcomes are equally likely and bit.

Binary entropy curve showing zero uncertainty at p=0 and p=1 and maximum uncertainty at p=0.5 Figure 1: The binary entropy is symmetric around , where uncertainty is maximized.

Entropy therefore measures uncertainty rather than the numerical size of an outcome.

1.4 Entropy as description length

Entropy is closely connected to compression. If outcomes are encoded efficiently, common outcomes receive short binary descriptions and rare outcomes receive longer descriptions. The entropy is the fundamental target for the average number of bits required to describe the outcome.


2. Joint Entropy and Conditional Entropy

Entropy extends naturally from one random variable to several. For background on joint and conditional distributions, see Joint Probability Distributions.

2.1 Joint entropy

The pair can be treated as one vector-valued random variable. Its joint entropy is

Joint entropy measures how much uncertainty is present in the pair before either variable is observed.

2.2 Conditional entropy

After observing , our remaining uncertainty about is

The conditional entropy averages this quantity over :

The distinction is important:

  • is the uncertainty after one particular observation.
  • is the remaining uncertainty averaged over all possible observations of .

2.3 The two-variable entropy chain rule

Using the probability factorization

we obtain

Therefore,

The interpretation is sequential: first describe , then describe what remains unknown about once is available.

Reversing the order gives

In general, and are not equal. What is equal is the total joint uncertainty obtained after adding the appropriate marginal entropy.


3. Relative Entropy (KL Divergence)

Entropy describes uncertainty within one distribution. Relative entropy instead compares two distributions over the same alphabet :

  • is the distribution that actually generates the outcomes.
  • is the distribution used by our model, approximation, or code.

The question is: how costly is it to use when the data really follow ?

3.1 From the likelihood ratio to KL divergence

For one realized outcome , compare the probability assigned by the two distributions through the log-likelihood ratio

This quantity is positive when and negative when . However it is not a true distance between distributions since it is not symmetric and does not satisfy the triangle inequality. Nonetheless, it is often useful to think of relative entropy as a “distance” between distributions. Because outcomes are generated according to , we average the log-likelihood ratio under :

This expectation is the relative entropy or Kullback-Leibler divergence of relative to . With base-2 logarithms, it is measured in bits.

The order has meaning

In , samples come from , so determines how each log-ratio is weighted. Reversing the arguments changes both the ratios and the averaging distribution. The symbol is deliberately directional.

3.2 Coding interpretation: the cost of the wrong model

If we know the true distribution , the ideal description length assigned to outcome is

If we instead construct the code using , the same outcome receives length

Since outcomes still occur according to , the average length of the code based on is the cross-entropy

Adding and subtracting gives

Here is the entropy of the distribution . Therefore,

KL divergence is the extra average description length caused by using instead of the true distribution . If , there is no mismatch and the extra cost is zero.

3.3 Conditional relative entropy

For joint PMFs and , the conditional relative entropy between and , averaged over , is

The notation does not explicitly mention the averaging distribution ; as in the book, it is understood from context.

3.4 What KL divergence does and does not guarantee

KL divergence satisfies

with equality if and only if for every . This nonnegativity is not obvious from the individual terms, as the example above shows; it is a property of their expectation.

If some outcome satisfies but , then

The model declares an outcome impossible even though it can occur under the data-generating distribution, producing an infinite log-loss.

Finally, KL divergence is not a geometric distance. In general,

and KL divergence does not satisfy the triangle inequality.

This expected log-ratio viewpoint connects directly to maximum likelihood estimation and appears as a regularization term in variational autoencoders.


4. Mutual Information

Entropy measures uncertainty in one distribution, while KL divergence compares two distributions. Mutual information uses KL divergence to measure dependence between two variables:

Expanding the definition,

The product is the joint probability mass function we would have if and were independent. Mutual information therefore quantifies how distinguishable the actual joint distribution is from an independent one.

  • If and are independent, and .
  • If knowing reduces uncertainty about , then .

4.1 Mutual information as uncertainty reduction

Since ,

By symmetry,

Combining these expressions with the entropy chain rule gives the fundamental identities

Information diagram showing conditional entropy and mutual information as parts of joint entropy Figure 3: A mnemonic for the relationships among marginal entropy, conditional entropy, joint entropy, and mutual information.

Consequently,

and a variable contains all of its own uncertainty:

The venn diagram is a useful illustration: is drawn as the overlap between and , while and are the non-overlapping parts. The algebraic identities above are the actual definitions; the diagram should not replace them.

4.2 Conditional mutual information

The conditional mutual information between and given is

It measures how much observing reduces uncertainty about when is already known. In the expectation, uppercase , , and are random variables drawn jointly according to .


5. Chain Rules

Chain rules turn one complicated information quantity into a sequence of simpler contributions. The guiding question is:

If the variables are revealed one at a time, how much new uncertainty, information, or model mismatch appears at each step?

No independence assumption is required. Following Section 2.5 of Cover and Thomas, each rule below uses conditioning to avoid counting information that earlier variables have already explained.

5.1 Chain rule for entropy

Suppose we want to describe the entire tuple . We can describe first, then describe only the part of that remains uncertain after is known, and continue in this way. This gives

The first term is written separately because nothing has been revealed before . Every later term is conditional on all earlier variables.

For three variables, the rule reads

Why does this work? The joint PMF has the probability chain rule

Entropy averages the negative logarithm of this probability. The logarithm converts the product into a sum, so the probability factorization becomes an entropy decomposition.

The variables may be revealed in any order. The total joint entropy stays the same, although the individual conditional terms generally change with the order.

5.2 Chain rule for conditional entropy

Now suppose some side information is available before either or is revealed. We first measure the uncertainty left in given , and then the uncertainty left in after both and are known:

The identity can be checked by expressing conditional entropy as a difference of joint entropies:

For a longer sequence, keep in the conditioning set at every step:

The important point is that is known throughout the entire process. The conditioning set grows from to , then to , and so on. We are not repeatedly learning ; it is background information available from the beginning.

5.3 Chain rule for mutual information

Suppose several variables jointly tell us something about . The mutual-information chain rule attributes that information one variable at a time:

For two variables,

The first term measures what tells us about . The second does not count all information in again; it counts only what adds after is already known.

To see the decomposition algebraically, insert and subtract :

Repeating the same step yields the -variable formula. As with entropy, the individual contributions depend on the order of the , but their sum is always the total information .

5.4 Chain rule for relative entropy

Here we compare two joint models, and . Their total mismatch has two sources:

  1. The models may assign different probabilities to .
  2. Even after the same value of is given, their conditional models for may disagree.

Factor both joint PMFs into these two stages:

Substituting the factorizations into the log-ratio separates the two sources of mismatch:

Therefore,

The first term measures disagreement about the marginal distribution of . The second is the conditional relative entropy

so it averages the conditional mismatch over . In other words: first pay for using the wrong model of ; then, for each observed , pay the average additional cost of using the wrong conditional model of .


6. Summary

QuantityDefinitionInterpretation
EntropyUncertainty in
Joint entropyUncertainty in the pair
Conditional entropyUncertainty left in after observing
KL divergencePenalty for using when reality follows
Mutual informationDependence, or shared information, between and

The most important identities are

and

Together, these definitions provide the basic language used throughout information theory, coding, statistics, and machine learning.

In the next blog I will continue with very important Information Inequalities, Data Processing, and Fano’s Inequality, including Jensen’s inequality, the log-sum inequality, sufficient statistics, and limits on estimation error.


Reference

Thomas M. Cover and Joy A. Thomas. Elements of Information Theory, 2nd ed., Sections 2.1-2.5. Wiley, 2006.