Skip to main content
KetQat

Appearance

Definition · introductory

Shannon entropy

The average of -log2 p(x) over a probability distribution, measured in bits. It quantifies the uncertainty of a random variable and is the optimal compression rate for independent samples; joint and conditional entropies and the binary entropy function are defined from it.

Established definitionMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Let XX be a random variable with values in a finite set X\mathcal{X} and distribution p(x)=Pr⁡[X=x]p(x) = \Pr[X = x]. Its Shannon entropy is

H(X)=−∑x∈Xp(x)log⁡2p(x)=E[−log⁡2p(X)],H(X) = -\sum_{x \in \mathcal{X}} p(x) \log_2 p(x) = \mathbb{E}\big[ -\log_2 p(X) \big],

with the convention 0log⁡20=00 \log_2 0 = 0. It depends only on the distribution, so one also writes H(p)H(p). For two random variables X,YX, Y with joint distribution p(x,y)p(x, y), the joint entropy H(XY)H(XY) is the entropy of the pair, and the conditional entropy is

H(X∣Y)=H(XY)−H(Y)=∑yp(y) H(X∣Y=y),H(X \mid Y) = H(XY) - H(Y) = \sum_{y} p(y)\, H(X \mid Y = y) ,

the average over yy of the entropy of the conditional distribution p(x∣y)p(x \mid y). The binary entropy function is h2(p)=−plog⁡2p−(1−p)log⁡2(1−p)h_2(p) = -p \log_2 p - (1 - p)\log_2(1 - p) for p∈[0,1]p \in [0, 1], the entropy of a Bernoulli(pp) variable.

Basic properties, all in chapter 2 of Cover and Thomas:

  • 0≤H(X)≤log⁡2∣X∣0 \le H(X) \le \log_2 \abs{\mathcal{X}}, with H(X)=0H(X) = 0 iff XX is deterministic and H(X)=log⁡2∣X∣H(X) = \log_2\abs{\mathcal{X}} iff XX is uniform;
  • H(X∣Y)≥0H(X \mid Y) \ge 0, and H(X∣Y)≤H(X)H(X \mid Y) \le H(X) (conditioning does not increase entropy), with equality iff XX and YY are independent;
  • chain rule H(X1…Xn)=∑i=1nH(Xi∣X1…Xi−1)H(X_1 \dots X_n) = \sum_{i=1}^{n} H(X_i \mid X_1 \dots X_{i-1}), and hence subadditivity H(X1…Xn)≤∑iH(Xi)H(X_1 \dots X_n) \le \sum_i H(X_i);
  • H(f(X))≤H(X)H(f(X)) \le H(X) for every function ff.

The upper bounds follow from Gibbs' inequality. The definition is due to Shannon. The quantum generalisation is the von Neumann entropy, which equals the Shannon entropy of the eigenvalue distribution; unlike H(X∣Y)H(X \mid Y), the quantum conditional entropy can be negative.

Holds when

  • Random variables take values in finite sets; countable alphabets work the same way when the sums converge.
  • Logarithms are base 2 (bits) unless stated; natural logarithms give nats.
Generalized by

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. C. E. Shannon (1948). A Mathematical Theory of Communication. Bell System Technical Journal 27 (3), 379-423. doi:10.1002/j.1538-7305.1948.tb01338.x
  2. Thomas M. Cover, Joy A. Thomas (2005). Elements of Information Theory. Wiley (2nd edition). doi:10.1002/047174882X

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Definition, conditional entropy, binary entropy and all listed properties (bounds with equality cases, conditioning reduces entropy, chain rule, subadditivity, H(f(X)) <= H(X)) re-derived and checked numerically on 500 random joint distributions; consistent with Polyanskiy and Wu, Information Theory: From Coding to Learning (authors' open PDF), chapters 1-3. Cover and Thomas chapter 2 title confirmed from Crossref chapter metadata (book not read); Crossref metadata for Shannon (1948) matches the entry.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e

Current revision 7a1f00d0717cd50f. Source file knowledge/records/definition/shannon-entropy.md in the content repository (readable there once it is public).