Math 2.0

Information and communication theory, circuits Definition

Kullback–Leibler divergence

Builds on Probability measureNatural logarithmProbability mass function

Definition

Let (Ω,ℱ)(\Omega, \mathcal{F}) be a measurable space, and let PP and QQ be probability measures on it. If PP is absolutely continuous with respect to QQ, let dP/dQdP/dQ be the Radon–Nikodym derivative, and define D(P ∥ Q)=∫Ωlog⁡dPdQ dP∈[0,∞].D(P \,\|\, Q) = \int_{\Omega} \log \frac{dP}{dQ} \, dP \in [0, \infty]. If PP is not absolutely continuous with respect to QQ, define D(P ∥ Q)=∞D(P \,\|\, Q) = \infty. The number D(P ∥ Q)D(P \,\|\, Q) is the Kullback–Leibler divergence of PP from QQ.

Remarks

The integral is well defined: with f=dP/dQf = dP/dQ, it equals ∫flog⁡f dQ\int f \log f \, dQ, and flog⁡f≥−1/ef \log f \ge -1/e, so its negative part is integrable. By Jensen's inequality it is non-negative, with equality exactly when P=QP = Q; this is Gibbs' inequality.

For distributions on a countable set with probability mass functions pp and qq, D(P ∥ Q)=∑xp(x)log⁡p(x)q(x),D(P \,\|\, Q) = \sum_{x} p(x) \log \frac{p(x)}{q(x)}, with the conventions 0log⁡0q=00 \log \frac{0}{q} = 0 and plog⁡p0=∞p \log \frac{p}{0} = \infty for p>0p > 0. With densities pp and qq with respect to a common measure, the sum becomes an integral. The base of the logarithm fixes the unit: base ee gives nats, base 22 gives bits.

Example: let PP be the Bernoulli law with parameter 1/21/2 and QQ the Bernoulli law with parameter 1/41/4. Then D(P ∥ Q)=12log⁡1/21/4+12log⁡1/23/4=12log⁡43D(P \,\|\, Q) = \frac{1}{2} \log \frac{1/2}{1/4} + \frac{1}{2} \log \frac{1/2}{3/4} = \frac{1}{2} \log \frac{4}{3}. In the other order, D(Q ∥ P)=14log⁡12+34log⁡32=14log⁡2716D(Q \,\|\, P) = \frac{1}{4} \log \frac{1}{2} + \frac{3}{4} \log \frac{3}{2} = \frac{1}{4} \log \frac{27}{16}. These differ, so DD is not symmetric and is not a metric.

Example of the infinite case: let QQ be the Dirac measure at 00 and PP the Bernoulli law with parameter 1/21/2. Then P({1})>0=Q({1})P(\set{1}) > 0 = Q(\set{1}), so PP is not absolutely continuous with respect to QQ, and D(P ∥ Q)=∞D(P \,\|\, Q) = \infty.

Pinsker's inequality bounds the total variation distance by D(P ∥ Q)/2\sqrt{D(P \,\|\, Q)/2}.

Reading path

To understand this page from the ground up, read these 4 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Natural logarithm concept
  2. Probability mass function concept
  3. Probability measure concept
  4. Kullback–Leibler divergence definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence
About this page
TagWW7HPC3WKA
URIm2://WW7HPC3WKA
Kinddefinition
WritingW0 stub
MSC94A17, 62B10, 60F10
DefinesKullback–Leibler divergence
UsesProbability measure, Natural logarithm, Probability mass function
Changed2 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.