Entropy and Information
A single number that measures how uncertain a random outcome is — equivalently, how much information you gain when you learn it, or how many yes/no questions it takes to pin it down. Highest when everything is equally likely, zero when the answer is already certain.
Prerequisites: Expected Value
Entropy is a one-number answer to "how uncertain is this?" A coin you know will land heads has no uncertainty; a fair coin has some; a fair roulette wheel has a lot. Shannon's insight was that these can be put on a common scale — measured in bits — and that the very same number answers three questions at once: how surprised you are on average by the outcome, how much information you gain by learning it, and how many yes/no questions it takes to identify it. High entropy means unpredictable; zero entropy means you already knew the answer.
The formula
For an outcome with possible values of probability , the (Shannon) entropy is
Each is the probability of one outcome, and (log base 2) is what makes the units come out in bits. The quantity is the surprise of outcome : rare outcomes (small ) are very surprising, near-certain ones barely register. Entropy is just the expected surprise — the average, weighted by how often each outcome occurs. It bottoms out at 0 when one outcome is certain, and it is largest when every outcome is equally likely.
Entropy is the average surprise of an outcome, in bits. It is largest when outcomes are equally likely (maximum uncertainty) and exactly zero when one outcome is certain (nothing left to learn).
Worked example: coins and dice
A fair coin. Two outcomes, each probability :
One bit — exactly one yes/no question ("heads?") settles it.
A biased coin, 90% heads. Now the surprises are lopsided:
Under half a bit. A lopsided coin is easy to predict, so learning the result tells you less. A fair six-sided die, by contrast, has bits — more outcomes, more uncertainty, so it takes between two and three yes/no questions on average to identify the face.
Read entropy as "the average number of yes/no questions to identify the outcome." A near-certain event carries almost no information — which is why a market with a foregone conclusion, or a signal that is nearly always the same, offers little to trade on.
Where the intuition slips
- Values don't matter, only probabilities do. Entropy sees a fair coin that pays a penny and one that pays your life savings as identical — both are 1 bit. It measures unpredictability, not stakes or magnitude. Never confuse high entropy with high risk in dollar terms.
- Units are a convention. Using gives bits; natural log gives "nats." The numbers scale by a constant, so always note the base before comparing.
- Continuous entropy is a different animal. Extending entropy to continuous variables (differential entropy) can go negative and depends on your units, so the clean "always non-negative, zero means certain" story is a discrete-only property.
Entropy is the foundation of information theory and the anchor for its most useful cousin, KL divergence, which measures how far one distribution sits from another. It also underlies information-theoretic signal and feature selection, and it connects to maximum likelihood through the idea of coding data as compactly as its uncertainty allows.
Related concepts
Practice in interviews
Further reading
- Shannon, A Mathematical Theory of Communication (1948)
- Cover & Thomas, Elements of Information Theory (ch. 2)