A logbook for curious waters
← All Reckonings

The Daily Reckoning

Why Is a Fair Coin Worth One Bit?

Binary entropy turns a coin's bias into a precise measure of uncertainty—and explains why one fair toss carries the most information possible from two outcomes.

Difficulty
Intermediate
Area
Probability and information theory
Reading time
9 minutes
Prerequisites
Probabilities between 0 and 1 · Logarithms base 2 · Weighted averages
A dark maritime blueprint shows a luminous coin balanced at the crest of a cyan entropy curve. Equal magenta and acid-green signal paths branch toward binary pulses on opposite sides, above contour lines resembling waves.

Suppose a distant buoy tosses a coin once every minute and sends you the result. If the coin is fair, either result is plausible. If the coin lands heads 99 times out of 100, the next head tells you very little; the rare tail does nearly all the surprising.

How many binary digits should one toss be worth on average?

The answer is not automatically one. A fair coin carries exactly one bit per toss, but a predictable coin carries less. The quantity that measures the difference is binary entropy.

Surprise first, then an average

An event with probability qq has self-information

I(q)=−log⁡2q=log⁡2 ⁣(1q)I(q)=-\log_2 q=\log_2\!\left(\frac{1}{q}\right)

bits. Here qq is a number between 00 and 11, and log⁡2\log_2 is the logarithm base 22.

The logarithm gives the right behavior for independent events. If two events have probabilities q1q_1 and q2q_2, their joint probability is q1q2q_1q_2, and

−log⁡2(q1q2)=−log⁡2q1−log⁡2q2.-\log_2(q_1q_2)=-\log_2 q_1-\log_2 q_2.

Independent surprises add.

For a coin, let pp be the probability of heads. The probability of tails is 1−p1-p. A head contributes −log⁡2p-\log_2p bits when it occurs, while a tail contributes −log⁡2(1−p)-\log_2(1-p) bits. Average those two possible contributions using their probabilities as weights:

H(p)=−plog⁡2p−(1−p)log⁡2(1−p).\boxed{H(p)=-p\log_2p-(1-p)\log_2(1-p)}.

The function HH is the binary entropy function. Its value H(p)H(p) is measured in bits per toss. At p=0p=0 or p=1p=1, the expression uses the limiting convention 0log⁡20=00\log_2 0=0. A coin that never changes carries zero bits because its next result is already known.

The diagram below plots H(p)H(p) for every possible bias. Move the slider or use the preset buttons. The solid curve and the cross-shaped marker provide shape cues in addition to color.

Binary entropy explorer

Move the bias; measure the uncertainty

0.50
Binary entropy when heads has probability one halfThe entropy curve rises from zero, reaches one bit at a one-half probability of heads, and falls symmetrically to zero. A marker sits at the highest point.
Heads0.50
Tails0.50
Entropy per toss1.000 bit
Most uncertainty?Yes — the maximum
What to notice: exchanging heads and tails reflects the marker across p = 0.5 but leaves the entropy unchanged. The fair coin reaches one bit per toss; a coin that always lands the same way has zero entropy.

The curve is symmetric because changing the labels “heads” and “tails” changes pp to 1−p1-p without changing the uncertainty. Its highest point occurs at p=1/2p=1/2:

H ⁣(12)=−12log⁡212−12log⁡212=12+12=1.H\!\left(\frac12\right) =-\frac12\log_2\frac12-\frac12\log_2\frac12 =\frac12+\frac12 =1.

One fair toss resolves one evenly balanced yes-or-no question. That is the unit called a bit.

Worked example: a coin with one-quarter heads

Now take p=1/4p=1/4. Substitute the two outcome probabilities into the definition:

H ⁣(14)=−14log⁡214−34log⁡234.H\!\left(\frac14\right) =-\frac14\log_2\frac14-\frac34\log_2\frac34.

Evaluate the heads term first. Because 1/4=2−21/4=2^{-2},

−14log⁡214=−14(−2)=12.-\frac14\log_2\frac14 =-\frac14(-2) =\frac12.

For the tails term, log⁡2(3/4)≈−0.4150375\log_2(3/4)\approx-0.4150375, so

−34log⁡234≈−34(−0.4150375)≈0.3112781.-\frac34\log_2\frac34 \approx-\frac34(-0.4150375) \approx0.3112781.

Add the weighted contributions:

H ⁣(14)≈0.5+0.3112781=0.8112781 bits per toss.H\!\left(\frac14\right) \approx0.5+0.3112781 =0.8112781\text{ bits per toss}.

The answer is below one bit because heads and tails are not equally uncertain. A head is more surprising than a tail, but heads occur only one-quarter of the time. Entropy accounts for both the surprise of an outcome and how often that outcome appears.

Why the fair coin is the maximum

The graph suggests that H(p)H(p) peaks at p=1/2p=1/2. A derivative verifies the claim. For 0<p<10<p<1,

H′(p)=log⁡2 ⁣(1−pp).H'(p)=\log_2\!\left(\frac{1-p}{p}\right).

When p<1/2p<1/2, the fraction (1−p)/p(1-p)/p is greater than 11, so H′(p)>0H'(p)>0 and the curve rises. At p=1/2p=1/2, the fraction equals 11, so H′(p)=0H'(p)=0. When p>1/2p>1/2, the fraction is less than 11, so H′(p)<0H'(p)<0 and the curve falls. Therefore the fair coin gives the largest possible binary entropy.

There is also a counting intuition. A string of nn fair tosses has 2n2^n equally likely possibilities. Naming one possibility requires nn yes-or-no digits because

log⁡2(2n)=n.\log_2(2^n)=n.

For a biased coin, most long strings cluster around the usual proportion of heads. Those probable strings occupy a much smaller part of the full set of 2n2^n strings. A well-designed lossless code can give shorter descriptions to the probable strings and longer descriptions to rare strings.

Shannon’s source-coding theorem makes the last idea precise: for a long sequence of independent tosses with fixed heads probability pp, the average length of a uniquely decodable lossless code can approach H(p)H(p) bits per toss, but cannot remain below that limit. The claim concerns long-run average length. It does not say that every individual message can be compressed.

From telegraph choices to information theory

Engineers were quantifying communication before entropy received its modern formula. In 1928, Bell Telephone Laboratories researcher Ralph Hartley published “Transmission of Information” in the Bell System Technical Journal. Hartley proposed a logarithmic measure for a message selected from a fixed number of alternatives. The measure treated the alternatives as equally available and connected information to the physical limits of telegraph and telephone systems.

Claude Shannon worked at Bell Labs from 1941 to 1972. During World War II, he studied cryptography and secrecy systems as part of the laboratory’s military communications work; an MIT account of Shannon’s career also records his team’s work on anti-aircraft fire-control systems. Wartime research did not create every ingredient of information theory, but secrecy, noise, signaling, and reliable transmission were concrete problems in Shannon’s working environment.

Shannon’s 1948 paper “A Mathematical Theory of Communication” acknowledged earlier work by Hartley and Harry Nyquist, then built a theory that allowed symbols to have unequal probabilities. Shannon named the weighted logarithmic quantity entropy and proved fundamental limits for data compression and reliable communication through noise. The paper appeared in the July and October issues of the Bell System Technical Journal; MIT OpenCourseWare’s historical notes preserve that publication history.

The institutional setting mattered. Bell Labs was the research arm of the regulated Bell telephone system, whose nationwide network created both the money and the engineering problems for sustained research on communication. Bell Labs research on communication crossed military and civilian uses. After the war, Shannon’s mathematics became a foundation for digital telephony, computer storage, satellite links, and the internet.

Where entropy earns its keep

Lossless compressors exploit unequal probabilities. Text compressors, for example, can represent frequent patterns with shorter codewords and reserve longer codewords for rarer patterns. The achievable average length is governed by the entropy of the source model, although practical files also contain structure, headers, and model errors that the single-coin formula does not capture.

Communication engineers use entropy when separating two jobs. Source coding removes predictable redundancy so that a message uses fewer bits on average. Channel coding adds carefully structured redundancy so that a receiver can detect or repair damage. The earlier Reckoning on Hamming’s seven-bit code studies the second job. Shannon’s theory supplies limits for both jobs, while practical codes determine how closely a real system approaches those limits.

Entropy also appears in statistical inference, machine learning, cryptography, and the study of random processes. In each setting, the probability model must be stated. “The entropy of the data” is not a complete quantity until the possible outcomes and their probabilities are specified.

Test the measure

Problem 1

A coin lands heads with probability 1/81/8. Find its binary entropy to three decimal places.

Reveal the solution

Here p=1/8p=1/8 and 1−p=7/81-p=7/8. Substitute:

H ⁣(18)=−18log⁡218−78log⁡278.H\!\left(\frac18\right) =-\frac18\log_2\frac18-\frac78\log_2\frac78.

Because log⁡2(1/8)=−3\log_2(1/8)=-3, the first term is

−18(−3)=38=0.375.-\frac18(-3)=\frac38=0.375.

Also, log⁡2(7/8)≈−0.1926451\log_2(7/8)\approx-0.1926451, so the second term is

−78(−0.1926451)≈0.1685645.-\frac78(-0.1926451)\approx0.1685645.

Therefore

H ⁣(18)≈0.375+0.1685645=0.5435645,H\!\left(\frac18\right)\approx0.375+0.1685645=0.5435645,

or 0.5440.544 bits per toss to three decimal places.

Problem 2

Without calculating two separate logarithmic expressions, compare the entropy of a coin with p=0.1p=0.1 to the entropy of a coin with p=0.9p=0.9.

Reveal the solution

The two entropies are equal. Replacing pp by 1−p1-p swaps the two terms in

H(p)=−plog⁡2p−(1−p)log⁡2(1−p)H(p)=-p\log_2p-(1-p)\log_2(1-p)

without changing their sum. The coin with p=0.9p=0.9 is as predictable as the coin with p=0.1p=0.1; only the labels of the common and rare outcomes have changed. Both entropies are approximately 0.4690.469 bits per toss.

One idea to remember

Information measures resolved uncertainty, not the mere presence of a symbol. A fair binary choice carries one bit because neither result is favored; prediction squeezes the average information below one.

A useful next step is to derive entropy for three or more outcomes, where the binary formula becomes H=−∑ipilog⁡2piH=-\sum_i p_i\log_2p_i, or to study prefix codes that turn those probabilities into decodable bit strings.

Sources