Information Theory formula reference

Kullback–Leibler Divergence

Measures directed discrepancy from a reference distribution q to a target distribution p.

Open in editor
LaTeXD_{\mathrm{KL}}(p\|q)=\sum_x p(x)\log\frac{p(x)}{q(x)}

Variables

  • p, q: probability distributions

How to use this formula

Measures directed discrepancy from a reference distribution q to a target distribution p.

Important notes

  • KL divergence is not symmetric and is not a metric.

Quick example

D_KL(p||q)=0 only when p and q agree almost everywhere.

Applicability, worked calculation, and verification

Assumptions and domain checks

  • KL divergence is not symmetric and is not a metric.
  • For the Kullback–Leibler Divergence, every denominator must be nonzero, and the numerator and denominator must remain correctly grouped.
  • Logarithm arguments must be positive in the real domain, and the base must be stated when it is not implied.
  • For the Kullback–Leibler Divergence, the index variable, lower bound, upper bound, and any empty-sum or empty-product convention must be clear.

Worked example

Input

Output

D_KL(p||q)=0 only when p and q agree almost everywhere.

Common mistakes

  • When copying Kullback–Leibler Divergence, keep the complete numerator and denominator grouped; a missing brace or parenthesis changes the result.
  • Do not compare entropy or information values computed with different logarithm bases without converting the units.

Continue the workflow

Use Kullback–Leibler Divergence in your own work

  1. Check the domainMatch the variables and assumptions to the problem before substituting values.
  2. Copy the exact notationPreserve grouping, signs, and exponents in D_{\mathrm{KL}}(p\|q)=\sum_x p(x)\log\frac{p(x)}{q(x)}.
  3. Edit or convertOpen the expression in the LaTeX editor, then export it for your document or web page.

Review and verification

Last reviewed: 2026-07-23

Automated quality check: Kept noindex until the missing evidence is supplied.

Formula references

Frequently asked questions

What is the Kullback–Leibler Divergence used for?

Measures directed discrepancy from a reference distribution q to a target distribution p.

Can I copy this formula as LaTeX?

Yes. Copy D_{\mathrm{KL}}(p\|q)=\sum_x p(x)\log\frac{p(x)}{q(x)} or open it in the LaTeX editor.

What should I check before using it?

Confirm that each variable, unit, domain restriction, and assumption matches the problem.

Reuse, attribution, and correction

Share this reference without losing its source

Copy a citation, permanent link, Markdown link, or self-contained embed card. Each reusable format points readers back to the maintained canonical page.

Report an issue

Search the whole reference

Symbols, formulas, guides, tools and commands

Start typing to search.

move · Enter open · Esc close