A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Shannon Entropy

Graduate Depth 90 in the knowledge graph ☐ I know this ☆ Set as goal
40topics build on this
412prerequisites beneath it
See this on the map →
Expected ValueLogarithms Introduction+2 more→→Algorithmic Information TheoryArithmetic Coding+16 more
entropy uncertainty information bits Shannon

Core Idea

Shannon entropy H(X) = -sum p(x) log p(x) quantifies the average uncertainty or "surprise" in a random variable X. It measures the minimum average number of bits needed to encode outcomes drawn from a distribution. A fair coin has entropy 1 bit; a biased coin has less. Entropy is maximized when all outcomes are equally likely and equals zero only when the outcome is certain. It is the foundational quantity of information theory, from which nearly all other measures are derived.

Explainer

You know from probability that a random variable X has a distribution assigning probabilities to outcomes. Shannon's insight was to ask: how much "information" does observing an outcome of X provide? If an event has probability p, the surprise (or self-information) of seeing it is -log2(p) bits. A coin landing heads with probability 1/2 gives -log2(1/2) = 1 bit of surprise. An event with probability 1 gives zero surprise — you already knew it would happen. An event with probability 1/1024 gives 10 bits — it was deeply unexpected.

Shannon entropy is the expected surprise: H(X) = -sum over all x of p(x) * log2(p(x)). It averages the surprise across all possible outcomes, weighted by how often each occurs. For a fair coin, H = 1 bit. For a fair die, H = log2(6) ≈ 2.58 bits. For a degenerate distribution (one outcome certain), H = 0. The key formula uses the convention that 0 * log(0) = 0, which is justified by the limit as p approaches 0.

The operational meaning of entropy is precise: it is the minimum average number of bits per symbol needed to losslessly encode a long sequence of independent draws from the distribution. If a source has entropy 2 bits per symbol, no encoding scheme can compress the output to fewer than 2 bits per symbol on average (and there exist schemes, like Huffman or arithmetic coding, that get arbitrarily close). This is Shannon's source coding theorem, which gives entropy its concrete, engineering significance.

Entropy has several important properties. It is non-negative for discrete distributions. It is maximized by the uniform distribution (maximum ignorance). It is concave — mixtures of distributions have at least as much entropy as the average of their individual entropies. And it is additive for independent random variables: H(X, Y) = H(X) + H(Y) when X and Y are independent. These properties make entropy the natural measure of uncertainty, and all other information-theoretic quantities — joint entropy, conditional entropy, mutual information, KL divergence — are defined in terms of it.

Practice Questions 4 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Angle Pairs: Complementary, Supplementary, and Vertical → Parallel Lines and Transversals → Corresponding Angles → Alternate Interior Angles → Triangle Angle Sum Theorem → Exterior Angle Theorem → Triangle Inequality Theorem → Similar Triangles: AA Similarity → Similar Triangles: SSS and SAS Similarity → Proportions in Similar Triangles → Right Triangle Trigonometry Introduction → Sine, Cosine, and Tangent Ratios → Trigonometric Ratios Review → Radian Measure → Converting Between Degrees and Radians → The Unit Circle → Graphing Sine and Cosine → Graphing Tangent and Reciprocal Trigonometric Functions → Derivatives of Trigonometric Functions → Antiderivatives → Indefinite Integrals → Basic Integration Rules → Riemann Sums → Definite Integral Definition → Probability Density Functions and Continuous Distributions → Cumulative Distribution Functions → Continuous Random Variables → Probability Density Functions → Expected Value → Shannon Entropy

Longest path: 91 steps · 412 total prerequisite topics

Prerequisites (4)

Leads To (18)