Gibbs' inequality

From HandWiki

thumb|200px|Josiah Willard Gibbs In information theory, Gibbs' inequality is a statement about the information entropy of a discrete probability distribution. Several other bounds on the entropy of probability distributions are derived from Gibbs' inequality, including Fano's inequality. It was first presented by J. Willard Gibbs in the 19th century.

Gibbs' inequality

Suppose that

[math]\displaystyle{ P = \{ p_1 , \ldots , p_n \} }[/math]

is a discrete probability distribution. Then for any other probability distribution

[math]\displaystyle{ Q = \{ q_1 , \ldots , q_n \} }[/math]

the following inequality between positive quantities (since pi and qi are between zero and one) holds:[1]:68

[math]\displaystyle{ - \sum_{i=1}^n p_i \log p_i \leq - \sum_{i=1}^n p_i \log q_i }[/math]

with equality if and only if

[math]\displaystyle{ p_i = q_i }[/math]

for all i. Put in words, the information entropy of a distribution P is less than or equal to its cross entropy with any other distribution Q.

The difference between the two quantities is the Kullback–Leibler divergence or relative entropy, so the inequality can also be written:[2]:34

[math]\displaystyle{ D_{\mathrm{KL}}(P\|Q) \equiv \sum_{i=1}^n p_i \log \frac{p_i}{q_i} \geq 0. }[/math]

Note that the use of base-2 logarithms is optional, and allows one to refer to the quantity on each side of the inequality as an "average surprisal" measured in bits.


For simplicity, we prove the statement using the natural logarithm (ln). Because

[math]\displaystyle{ \log_b a = \frac{ \ln a }{ \ln b }, }[/math]

the particular logarithm base b > 1 that we choose only scales the relationship by the factor 1 / ln b.

Let [math]\displaystyle{ I }[/math] denote the set of all [math]\displaystyle{ i }[/math] for which pi is non-zero. Then, since [math]\displaystyle{ \ln x \leq x-1 }[/math] for all x > 0, with equality if and only if x=1, we have:

[math]\displaystyle{ - \sum_{i \in I} p_i \ln \frac{q_i}{p_i} \geq - \sum_{i \in I} p_i \left( \frac{q_i}{p_i} - 1 \right) }[/math][math]\displaystyle{ = - \sum_{i \in I} q_i + \sum_{i \in I} p_i = - \sum_{i \in I} q_i + 1 \geq 0 }[/math]

The last inequality is a consequence of the pi and qi being part of a probability distribution. Specifically, the sum of all non-zero values is 1. Some non-zero qi, however, may have been excluded since the choice of indices is conditioned upon the pi being non-zero. Therefore, the sum of the qi may be less than 1.

So far, over the index set [math]\displaystyle{ I }[/math], we have:

[math]\displaystyle{ - \sum_{i \in I} p_i \ln \frac{q_i}{p_i} \geq 0 }[/math],

or equivalently

[math]\displaystyle{ - \sum_{i \in I} p_i \ln q_i \geq - \sum_{i \in I} p_i \ln p_i }[/math].

Both sums can be extended to all [math]\displaystyle{ i=1, \ldots, n }[/math], i.e. including [math]\displaystyle{ p_i=0 }[/math], by recalling that the expression [math]\displaystyle{ p \ln p }[/math] tends to 0 as [math]\displaystyle{ p }[/math] tends to 0, and [math]\displaystyle{ (-\ln q) }[/math] tends to [math]\displaystyle{ \infty }[/math] as [math]\displaystyle{ q }[/math] tends to 0. We arrive at

[math]\displaystyle{ - \sum_{i=1}^n p_i \ln q_i \geq - \sum_{i=1}^n p_i \ln p_i }[/math]

For equality to hold, we require

  1. [math]\displaystyle{ \frac{q_i}{p_i} = 1 }[/math] for all [math]\displaystyle{ i \in I }[/math] so that the equality [math]\displaystyle{ \ln \frac{q_i}{p_i} = \frac{q_i}{p_i} -1 }[/math] holds,
  2. and [math]\displaystyle{ \sum_{i \in I} q_i = 1 }[/math] which means [math]\displaystyle{ q_i=0 }[/math] if [math]\displaystyle{ i\notin I }[/math], that is, [math]\displaystyle{ q_i=0 }[/math] if [math]\displaystyle{ p_i=0 }[/math].

This can happen if and only if [math]\displaystyle{ p_i = q_i }[/math] for [math]\displaystyle{ i = 1, \ldots, n }[/math].

Alternative proofs

The result can alternatively be proved using Jensen's inequality, the log sum inequality, or the fact that the Kullback-Leibler divergence is a form of Bregman divergence. Below we give a proof based on Jensen's inequality:

Because log is a concave function, we have that:

[math]\displaystyle{ \sum_i p_i \log\frac{q_i}{p_i} \le \log\sum_i p_i\frac{q_i}{p_i} = \log\sum_i q_i \le 0 }[/math]

Where the first inequality is due to Jensen's inequality, and the last equality is due to the same reason given in the above proof.

Furthermore, since [math]\displaystyle{ \log }[/math] is strictly concave, by the equality condition of Jensen's inequality we get equality when

[math]\displaystyle{ \frac{q_1}{p_1} = \frac{q_2}{p_2} = \cdots = \frac{q_n}{p_n} }[/math]


[math]\displaystyle{ \sum_i q_i = 1 }[/math]

Suppose that this ratio is [math]\displaystyle{ \sigma }[/math], then we have that

[math]\displaystyle{ 1 = \sum_i q_i = \sum_i \sigma p_i = \sigma }[/math]

Where we use the fact that [math]\displaystyle{ p, q }[/math] are probability distributions. Therefore, the equality happens when [math]\displaystyle{ p = q }[/math].


The entropy of [math]\displaystyle{ P }[/math] is bounded by:[1]:68

[math]\displaystyle{ H(p_1, \ldots , p_n) \leq \log n. }[/math]

The proof is trivial – simply set [math]\displaystyle{ q_i = 1/n }[/math] for all i.

See also


  1. 1.0 1.1 Pierre Bremaud (6 December 2012). An Introduction to Probabilistic Modeling. Springer Science & Business Media. ISBN 978-1-4612-1046-7. 
  2. David J. C. MacKay (25 September 2003). Information Theory, Inference and Learning Algorithms. Cambridge University Press. ISBN 978-0-521-64298-9.