The codeword lengths are integers. For necessity, take and view codewords as nodes of the binary tree. A codeword of length has descendant words at depth . Prefix-freeness makes these descendant sets disjoint, so
For sufficiency, reorder the lengths nondecreasingly. Assign words successively. At depth , words extending previously assigned codewords number
The asserted inequality, even after dropping the later nonnegative terms, gives
Thus at least one depth- word does not extend an earlier word. Choose it. Since lengths are nondecreasing, it cannot be a proper prefix of a shorter earlier word, and equal-length duplicates have been excluded. Induction constructs the required code. Therefore Kraft inequality is necessary and sufficient:
An instantaneous code can decode each symbol as soon as its final bit arrives, without waiting for later bits. Equivalently it is prefix-free: no codeword is a proper prefix of another, and different symbols receive different codewords.
For nonempty codewords, decoding greedily from the start of the bit string identifies the first codeword unambiguously; repeating identifies the whole sequence. Thus an instantaneous code is uniquely decodable under the ordinary nonempty-word convention.
A binary code assigns a finite binary word to each source symbol . In the ordinary unframed convention these codewords are nonempty. It is uniquely decodable when concatenation gives an injective map from finite symbol strings to bit strings:
The decoder can recover the entire symbol sequence without being told where codewords end. This is stronger than merely assigning distinct words to individual symbols.
The given logarithmic moment is
where the term is zero. It is attained by the positive distribution
whose probabilities sum to one. Write , so . For any distribution with the required logarithmic moment,
Consequently the unique maximizer and its entropy are
The increasing weights are consistent with the prescribed moment; they need not be a decreasing power law.
Normalize the candidate distribution by setting
The supplied finite sum gives its mean
Thus it meets the constraint. Since , every other distribution with mean satisfies
Nonnegativity and the equality case in part (a) prove
The maximum is unique; the entropy comparison uses the fixed mean rather than an unconstrained optimization.
For the uniform distribution , direct expansion gives
Part (a) therefore proves
with equality exactly for for every . Thus the uniform distribution is the unique entropy maximizer.
Let the input law again be . The second output symbol has probability regardless of the input, and the two remaining output probabilities sum to . Hence
with equality when the first and third output symbols each have probability . The row entropies are , so
Take and . The output is and both bounds are attained. Therefore
The equality conditions also show uniqueness of the optimum input law. The middle row is the average of the outer rows and carries extra conditional entropy without introducing a new output law; removing a redundant input symbol from a channel explains why it need not be used.
Figure 1.
Mutual information along symmetric input distributions for the three channels
. The first two channels attain log2(3/2) at uniform input, while the third attains one half bit by omitting its middle input. Details.
Every row has Shannon entropy , so for every input law. Since the output alphabet has three symbols, Gibbs inequality gives . The uniform input gives
so it attains the upper bound. Therefore
Uniform output is necessary for equality in the entropy bound, and the three displayed equations then force the uniform input, so this optimum input law is unique.
Let the input probabilities be and put . The output distribution and conditional entropy are
For fixed , the first and third output masses sum to . Their entropy is maximized when they are equal, so . Equivalently, if ,
The same bound holds at by continuity. Therefore , with equality for symmetric outer input probabilities. Writing , differentiate:
The unique zero is ; strict concavity makes it the global maximum. Thus and
The optimum output is .
Every positive atom has probability at most , so . Averaging yields
For , the supplied inequality gives . Rearranging proves
The two regimes combine into the entropy lower bound from the largest atom, valid for every finite probability distribution.
Choose a most probable symbol , and let . Its binary entropy is
Since is a function of , part (a)(ii) gives . On , the concave function lies above the chord joining and . That chord has height . Therefore
The endpoint is included by continuity and corresponds to a deterministic source.
Set . Given , the value of is certain, so . Applying the entropy identity in the two orders gives
because conditional entropy is nonnegative. Consequently
A deterministic coarsening can merge distinguishable source outcomes, but cannot create additional Shannon entropy.
For finite-valued random vectors, write and . The conditional entropy is the average entropy of the posterior distributions:
Equivalently, . Since , splitting the logarithm gives
Use the usual convention and omit conditionals at zero-probability outputs. The same identities hold for countable alphabets whenever the entropy sums are well-defined, without subtracting two infinite quantities.
A compact code or optimal prefix code minimizes the expected codeword length for the given source probabilities and coding alphabet. The relevant comparison here is among binary prefix codes. The minimum is also the minimum among uniquely decodable codes, since the Kraft-McMillan inequality permits every uniquely decodable length list to be realized by a prefix code with the same lengths.
A prefix code has no codeword that is a proper prefix of another. Its code tree therefore places source symbols at leaves. It is instantaneous because the decoder knows that a source symbol has ended as soon as its leaf is reached, without needing to inspect later transmitted symbols.
In the terminology used here, a block code assigns a distinct word of the same length to every source symbol. For a binary code with symbols this common length must satisfy . The equal-length property is what matters in this question; elsewhere the term can also refer more generally to coding blocks of source symbols.
For each , conditioning on all the other coordinates gives no greater conditional entropy than conditioning only on the preceding ones. Summing and using the chain rule for entropy gives directly
Equivalently, the left side is , so the same conclusion follows from Han's entropy inequality. The direct proof also covers , interpreting conditioning on an empty vector as no conditioning.
The chain rule for entropy, with placed last, gives
Since includes all the preceding coordinates, conditioning monotonicity gives
This proves the first assertion for every , including . Sum over : the conditional terms on the right sum to by the ordinary chain rule. Thus
This is Han's entropy inequality.
Factoring a joint probability into successive conditional probabilities and taking the expected negative logarithm gives the chain rule for entropy:
At this means the unconditional entropy. Removing conditioning can only increase each term by part (a), so .
Write for the vector omitting coordinate . Another application of the chain rule gives . Therefore
Divide by to obtain the required averaged inequality. The case is excluded precisely because that denominator vanishes.
Apply Gibbs inequality to the joint distribution and the product of its marginals. Restrict to the Cartesian product of their positive supports, so the reference probabilities are strictly positive as the supplied inequality requires. Expanding gives
This proves the second inequality. For the first, apply the same argument to the conditional joint distribution of for each with , and average with those probabilities:
Here the conditional support restriction again removes zero marginal probabilities. Thus
The nonnegative differences are conditional mutual information and mutual information, respectively.

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