The redundancy is , measured in bits per source symbol. Write for the total mass passing through interior node . Counting each codeword's length as one for each interior node its route visits gives
The entropy can be split into the conditional binary decisions along that route. Algebraically each node contributes
Summing telescopes: each non-root interior mass appears once positively as a parent and once negatively as a child. The root term is and the remaining leaf terms sum to . Hence
Subtracting this identity from the expected-length identity proves
Thus redundancy is the sum of the probability-weighted imbalances of the binary branch decisions. Nodes with no mass contribute zero by continuity. The formula holds for every full prefix tree, even without optimality.
Let . The Huffman encoder emits an average of binary digits per minute. Shannon's noisy-channel coding theorem states that for a discrete memoryless channel of capacity , every information rate strictly below bits per use is achievable with error probability tending to zero as block length grows; rates above are not achievable for unrestricted messages.
Thus a channel code carrying the Huffman bitstream reliably with buffering and arbitrarily long blocks can be chosen whenever
The strict inequality supplies positive coding and buffering slack. Huffman's expected-length bound is for a nontrivial finite source. Therefore the simpler bound is sufficient without knowing its exact Huffman lengths.
Distinguish this bitstream construction from the absolute source-channel limit. The noiseless source coding theorem permits long source blocks to be compressed to any rate above bits per source symbol, with arbitrarily small overhead. Together with channel coding, this gives the sharper limiting requirement ; is impossible by the source-channel converse. Further compression can exploit redundancy remaining in a single-symbol Huffman stream, so need not be the universal minimum channel symbol rate. At a positive-entropy source cannot be sent reliably at a finite rate.
The entropy is
To construct a Huffman code, work with integer weights . Merge the two twos to make four. Of the remaining weights , merge three with the original four to make seven, and merge the new four with five to make nine. Finally merge seven with nine. Resolving the tie in this way gives, for example,
This is a prefix code and Huffman's optimality theorem makes it optimal. Its expected length is
Different choices at a tied merge can give different optimal codewords with the same expected length.
Figure 1.
An optimal five-symbol Huffman tree
. Edge labels give the binary digits, leaf labels give the source symbols and their probabilities, and interior labels give total descendant probability. Details.
Unique decipherability makes the map from to the concatenated binary string injective. Entropy is unchanged by an injective relabelling, and memorylessness gives independence, hence
Given , the string has at most possibilities. The entropy bound for finite alphabets therefore gives . Averaging,
The random length cannot simply be discarded: it can also carry information. Let be the maximum codeword length, finite since the alphabet is finite. Since is a function of and takes at most values,
Divide by and let . This proves . The conclusion also covers a deterministic source; the source's lowercase in its final expectation denotes the random source letter.
Define . The joint entropy identity follows by writing and expanding its logarithm. If , then and , giving the desired decomposition.
Group the first two symbols together and keep the third separate. If , the identity becomes
where . Binary entropy is at most one, with equality precisely at . Hence
Equality holds exactly when . When , , so the same conclusion holds at the boundary.
For a finite probability distribution,
with . If the positive support has size , apply the given strict Jensen inequality to the random variable :
Equality requires and constant almost surely, so all probabilities are . Conversely the uniform distribution attains this bound. Thus , with exactly that equality case.
The conditional output distributions are permutations of the same triple, so both conditional entropies equal
With input probability , the three output probabilities are , , and . Therefore
Differentiating, the constant terms cancel because :
Thus there is a unique maximum. Its stationary equation reduces to , whose root in is
The other root is negative; strict concavity proves this is the global maximum.

Pinned article: Introduction to the OurBigBook Project

Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
We have two killer features:
  1. topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculus
    Articles of different users are sorted by upvote within each article page. This feature is a bit like:
    • a Wikipedia where each user can have their own version of each article
    • a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
    This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.
    Figure 1.
    Screenshot of the "Derivative" topic page
    . View it live at: ourbigbook.com/go/topic/derivative
  2. local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:
    This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
    Figure 5. . You can also edit articles on the Web editor without installing anything locally.
    Video 3.
    Edit locally and publish demo
    . Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension.
  3. https://raw.githubusercontent.com/ourbigbook/ourbigbook-media/master/feature/x/hilbert-space-arrow.png
  4. Infinitely deep tables of contents:
    Figure 6.
    Dynamic article tree with infinitely deep table of contents
    .
    Descendant pages can also show up as toplevel e.g.: ourbigbook.com/cirosantilli/chordate-subclade
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact