Foundations to Frontier
Tests
A. Mathematical Foundations › A7 Information Theory

Entropy, Joint and Conditional Entropy

Entropy measures uncertainty: the average number of bits needed to describe the outcome of a random variable. You will define Shannon entropy, joint and conditional entropy, prove the chain rule, the maximum-entropy property of the uniform distribution and that conditioning reduces entropy, meet differential entropy for continuous variables, and estimate the entropy of rover sensor data, the limit on how far it can be compressed.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Measuring surprise

If I tell you the Sun rose this morning, you learn almost nothing: it was certain. If I tell you which of 8 equally likely doors hides a prize, you learn a lot: exactly 3 yes/no questions’ worth. Entropy measures how much you learn, on average, when you find out the outcome. It’s high when things are unpredictable and zero when they’re certain.

It’s counted in bits, the number of yes/no questions you’d need.

How surprising is it? Entropy, joint and conditional
1 bitp → 1
H(p) = 0.722 bits · surprise: heads 2.32 bits, tails 0.32 bits
H(terrain) = 0.971H(slip) = 0.925joint H = 1.605 (bar span) · dashed overlap = I(X;Y) = 0.291
H(slip | terrain) = 0.634 · H(terrain | slip) = 0.680 · I = 0.291 bits
Entropy is the average surprise −log₂ p of an outcome: maximal (1 bit) for a fair coin, zero for a certain one. For two variables, the joint entropy is the total span of the two bars. Their overlap is the mutual information (A7-4), what one tells you about the other, and the parts sticking out are the conditional entropies. Make slip independent of terrain (equal slip probabilities) and the overlap vanishes. Make them deterministic (0 and 1) and slip is fully explained by terrain.
Why engineers care

Entropy sets the limit on how much telemetry can be compressed before downlink. It underlies the cross-entropy loss used to train classifiers, quantifies a robot’s uncertainty about where it is (active exploration picks actions that reduce it), and measures how informative a sensor is.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A certain outcome has entropy…
  2. 2. Choosing among 8 equally likely options needs how many yes/no questions?
  3. 3. Entropy is highest when outcomes are…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

Definition

For a discrete random variable XX with pmf pp:

H(X)=−∑xp(x)log⁡2p(x)=E[−log⁡2p(X)]H(X) = -\sum_xp(x)\log_2p(x) = \mathbb E[-\log_2p(X)]

It’s the average surprise −log⁡2p(x)-\log_2p(x), in bits (use ln⁡\ln for nats, where 1 nat ≈ 1.443 bits). Convention: 0log⁡0=00\log0 = 0.

Key facts

  • 0≤H(X)≤log⁡2∣X∣0\le H(X)\le\log_2|\mathcal X|, with the maximum at the uniform distribution.
  • Binary entropy: Hb(p)=−plog⁡2p−(1−p)log⁡2(1−p)H_b(p) = -p\log_2p - (1 - p)\log_2(1 - p). It’s 1 bit at p=12p = \frac12 and only about 0.5 bit at p=0.11p = 0.11.
  • Example: p=(12,14,14)p = (\frac12, \frac14, \frac14) gives H=12⋅1+2⋅14⋅2=1.5H = \frac12\cdot1 + 2\cdot\frac14\cdot2 = 1.5 bits.
📝 Quick check (Level 1)
0/3 answered
  1. 1. H(½, ¼, ¼) =
  2. 2. The maximum entropy over 16 outcomes is…
  3. 3. The surprise of an event with probability 1/8 is…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.

Joint and conditional entropy

H(X,Y)=−∑x,yp(x,y)log⁡p(x,y),H(Y∣X)=∑xp(x)H(Y∣X=x)H(X, Y) = -\sum_{x,y}p(x, y)\log p(x, y),\qquad H(Y\mid X) = \sum_xp(x)H(Y\mid X = x)
  • Chain rule: H(X,Y)=H(X)+H(Y∣X)H(X, Y) = H(X) + H(Y\mid X). For many variables, H(X1,…,Xn)=∑iH(Xi∣X<i)H(X_1, \dots, X_n) = \sum_iH(X_i\mid X_{<i}).
  • Conditioning reduces entropy on average: H(Y∣X)≤H(Y)H(Y\mid X)\le H(Y), with equality iff X⊥YX\perp Y. A particular observation X=xX = x can still increase uncertainty.
  • Subadditivity: H(X,Y)≤H(X)+H(Y)H(X, Y)\le H(X) + H(Y), with equality iff independent.
  • H(Y∣X)=0H(Y\mid X) = 0 iff YY is a function of XX.

Differential entropy

For densities: h(X)=−∫flog⁡fh(X) = -\int f\log f. It can be negative, and it changes under rescaling (h(aX)=h(X)+log⁡∣a∣h(aX) = h(X) + \log|a|). For a Gaussian, h=12log⁡2(2πeσ2)h = \frac12\log_2(2\pi e\sigma^2). Among all densities with variance σ2\sigma^2, the Gaussian has the maximum differential entropy.

🐍 Exercise 1: entropy calculus
Implement entropy, joint and conditional entropy. For a terrain × wheel-slip table, verify the chain rule, that conditioning reduces entropy, subadditivity with equality under independence, and the maximum-entropy property.
📝 Quick check (Level 2)
0/3 answered
  1. 1. H(X, Y) = H(X) + H(Y|X) is the…
  2. 2. H(Y|X) = 0 means…
  3. 3. Differential entropy can be…

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Proof: H(X) ≤ log₂|𝒳|

log⁡2∣X∣−H(X)=∑plog⁡2(p∣X∣)=KL⁡(p ∥ u)≥0\log_2|\mathcal X| - H(X) = \sum p\log_2(p|\mathcal X|) = \operatorname{KL}(p\,\|\,u)\ge0, where uu is uniform. Equivalently, by Jensen on the concave log: H=Elog⁡1p≤log⁡E1p=log⁡∣X∣H = \mathbb E\log\frac1p\le\log\mathbb E\frac1p = \log|\mathcal X|. ∎

Proof of the chain rule

log⁡p(x,y)=log⁡p(x)+log⁡p(y∣x)\log p(x, y) = \log p(x) + \log p(y\mid x). Take −E-\mathbb E of both sides. ∎

Proof that conditioning reduces entropy

H(Y)−H(Y∣X)=∑p(x,y)log⁡p(x,y)p(x)p(y)=I(X;Y)=KL⁡(pXY ∥ pXpY)≥0H(Y) - H(Y\mid X) = \sum p(x, y)\log\frac{p(x, y)}{p(x)p(y)} = I(X;Y) = \operatorname{KL}(p_{XY}\,\|\,p_Xp_Y)\ge0 (A7-3, A7-4). Equality holds iff pXY=pXpYp_{XY} = p_Xp_Y. ∎

Exercise 3.1: Differential entropy of Uniform[0, 0.5]

h=log⁡2(0.5)=−1h = \log_2(0.5) = -1 bit. Negative, showing that differential entropy isn’t a count of bits but a relative quantity.

📝 Quick check (Level 3)
0/3 answered
  1. 1. log₂|𝒳| − H(X) equals…
  2. 2. H(Y) − H(Y|X) equals…
  3. 3. Among variance-σ² densities, maximum differential entropy belongs to…

Level 4: Expert

★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.

How compressible is rover telemetry?

An IMU channel quantized to 8 bits (64 levels actually in use, roughly Gaussian) has about 4.6 bits of entropy per sample. No lossless compressor can beat that average (A7-7), so the best ratio is about 1.7×. Estimating entropy from data is itself biased: the plug-in (frequency) estimator underestimates, badly with small samples, because it never sees rare symbols. The Miller–Madow correction +(m−1)/(2nln⁡2)+(m - 1)/(2n\ln2) removes most of the bias.

🐍 Exercise 2 (research): estimating entropy from samples
Implement the plug-in and Miller–Madow entropy estimators. Measure their bias on a quantized sensor distribution at n = 100 and 1000, and relate the entropy to the compression limit.

Entropy in AI, robotics and aerospace

  • Telemetry compression is bounded by entropy. CCSDS lossless standards (Rice coding) approach it for spacecraft data (CCSDS 121.0-B).
  • Active perception and exploration: choose sensing actions that minimize posterior entropy over the map or the robot pose (Stachniss, Grisetti and Burgard, 2005).
  • Maximum-entropy RL (SAC) adds an entropy bonus to keep policies exploratory and robust (Haarnoja et al., 2018).
  • Maximum-entropy modelling: the least-committed distribution consistent with known constraints (Jaynes, 1957).

References

  1. C. Shannon (1948). “A mathematical theory of communication.” Bell System Technical Journal, 27.
  2. T. Cover, J. Thomas (2006). Elements of Information Theory, 2nd ed. Wiley. Ch. 2, 8.
  3. D. MacKay (2003). Information Theory, Inference, and Learning Algorithms. Cambridge University Press.
  4. E. T. Jaynes (1957). “Information theory and statistical mechanics.” Physical Review, 106(4).
  5. G. Miller (1955). “Note on the bias of information estimates.” Information Theory in Psychology.
  6. L. Paninski (2003). “Estimation of entropy and mutual information.” Neural Computation, 15(6).
  7. C. Stachniss, G. Grisetti, W. Burgard (2005). “Information gain-based exploration using Rao-Blackwellized particle filters.” RSS.
  8. T. Haarnoja et al. (2018). “Soft actor-critic: off-policy maximum entropy deep reinforcement learning with a stochastic actor.” ICML.
  9. CCSDS (2020). “Lossless Data Compression.” Recommended Standard 121.0-B-3.
  10. R. Gray (2011). Entropy and Information Theory, 2nd ed. Springer.