Gibbs' inequality
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 is a discrete probability distribution. Then for any other probability distribution the following inequality between positive quantities (since p and q are between zero and one) holds: with equality if and only if 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: 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. Proof. For simplicity, we prove the statement using the natural logarithm (ln), since the particular logarithm we choose only scales the relationship. Let formula_7 denote the set of all formula_8 for which "p" is non-zero . Then, since formula_9 for all "x > 0", with equality if and only if "x=1", we have: The last inequality is a consequence of the "p" and "q" being part of a probability distribution. Specifically, the sum of all non-zero values is 1. Some non-zero "q", however, may have been excluded since the choice of indices is conditioned upon the "p" being non-zero. Therefore the sum of the "q" may be less than 1. So far, over the index set formula_7, we have: or equivalently Both sums can be extended to all formula_15, i.e. including formula_16, by  recalling that the expression formula_17 tends to 0 as formula_18 tends to 0, and formula_19 tends to formula_20 as formula_21 tends to 0. We arrive at For equality to hold, we require This can happen if and only if formula_31 for formula_32. 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: 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 formula_34 is strictly concave, by the equality condition of Jensen's inequality we get equality when and Suppose that this ratio is formula_37, then we have that Where we use the fact that formula_39 are probability distributions. Therefore the equality happens when formula_40. Corollary. The entropy of formula_41 is bounded by: The proof is trivial – simply set formula_43 for all "i".