Log-sum inequality Created 2026-09-24 Updated 2026-09-24
For nonnegative , with and , the log-sum inequality is
It proves both Gibbs inequality and the data processing inequality for relative entropy.
Write . Mean-field variational inference minimizes the reverse Kullback-Leibler divergence
Each is a probability density function; without further parametric restrictions, the optimization is over all such product probability distributions. Equivalently it maximizes the evidence lower bound for any unnormalized posterior density . Its difference from is exactly the Kullback-Leibler divergence.
Fix and write
Assume and that the displayed expected values and objective decomposition are well defined. The optimal factor is
Indeed, the part of the objective depending on is
The remaining term is fixed. Gibbs inequality gives nonnegativity of the Kullback-Leibler divergence, with equality precisely at almost everywhere. This proves global optimality of that coordinate update; it does not assert global optimality of a sequence of coordinate updates for the full nonconvex product-family problem.
The printed upper index in the list of remaining coordinates is inconsistent with the dimension ; the natural interpretation is . Also, if the exponential expression has zero or infinite normalizing constant, or the expected values are undefined, the usual coordinate formula needs additional support or integrability hypotheses. A restricted parametric factor family need not contain this unrestricted optimal factor.
For a discrete random variable with probabilities , its Shannon entropy in bits is , with . Gibbs inequality states that
with equality exactly when . If , the left side is infinite. Otherwise apply to for :
Equality requires on the support and no remaining mass outside it. In particular, comparison with the uniform probability distribution on two outcomes gives binary Shannon entropy at most .
Write . For , grouping the last two outcomes gives
Equality holds if ; if it also holds, and then both are zero. Thus equality holds exactly when .
For the discrete memoryless channel, assume and , and set . Both conditional output probability distributions have Shannon entropy . The third output has probability regardless of the input; the first two have total probability . Their Shannon entropy is maximized by making them equal, which a uniform input achieves. Hence the channel capacity is
and therefore
The usual zero-times-log convention includes , when . If , the rows coincide and every input achieves zero mutual information; otherwise the uniform input is the unique maximizing input.
Let a memoryless source have probabilities , and let a uniquely decodable -ary code have word lengths and mean length . The Shannon source coding theorem states
and that some prefix code satisfies
For the lower bound, the Kraft inequality gives . Set . The Gibbs inequality, or nonnegativity of relative entropy, gives
Therefore .
For achievability choose . Then , so the converse part of the Kraft theorem supplies a prefix code with these lengths, and
Hence the entropy is the optimal mean code length up to less than one code symbol.
Take every logarithm in base two. The information entropy of is
with . If the codeword has length , then its expected codeword length is
For any decipherable code, the Kraft inequality gives
Define the probability distribution . By Gibbs inequality,
Since ,
Conversely, choose the integer lengths
Then , so their Kraft sum is at most one and the converse part of Kraft's inequality supplies a binary prefix code. Moreover,
Thus the minimum expected length satisfies the Shannon noiseless coding theorem
For a decipherable code with arbitrary lengths , apply the lower bound to the uniform source . Its entropy is and its expected length is . Hence
the total length lower bound for a decipherable binary code.
Now consider the cumulative construction. Since
and cannot have the same first binary digits: numbers sharing those digits lie in one half-open dyadic interval of length . Also, implies . Therefore no earlier codeword is a prefix of a later one, and no later, weakly longer codeword can be a prefix of an earlier one. The cumulative Shannon code is thus a prefix code, hence decipherable.
An optimal code minimizes expected codeword length over all decipherable codes for the specified source probabilities. The cumulative construction need not be optimal. For example, if
then and the construction gives codewords and , with expected length . The prefix code has expected length , so the constructed code is not optimal. In general, Huffman coding produces an optimal prefix code.
A distribution on must have . For , put and let
For any mass function with mean , Gibbs inequality gives
Thus the geometric distribution uniquely maximizes entropy. For , the only admissible law is the point mass at one, which is the limiting geometric case .
For , define the finite-alphabet exponential family
The mean is continuous and nondecreasing in , with limits and as and . The strict interior assumption on therefore supplies a with .
For any other satisfying the same constraint,
so
Equality in Gibbs inequality holds only for . Hence this Gibbs-form mass function is the unique entropy maximizer.
Write , , and
On the support of , define the probability mass function
For any real length function satisfying the Kraft inequality, put and . The Gibbs inequality gives
Equality holds for the ideal weighted lengths
Thus the smallest average weighted description length is
When has full support, the displayed attains this minimum. If some strings have zero probability, the same value is the infimum over finite lengths and is attained by the extended-real ideal assignment there; finite codewords of arbitrarily large length approach it.
For , define the exponentially tilted mass function . Gibbs inequality gives
Rearranging proves
For the distribution from part (a),
Therefore
by Gibbs inequality and .