Why convexity enters f-divergence
On this page 6 headings
The example introduces variational divergence minimization through f-divergences. Under the standard density-ratio formulation, let P and Q have densities p and q, and assume P is absolutely continuous with respect to Q. For a convex generating function f on nonnegative ratios, normalized by
For the calculations below, we first use discrete distributions with positive Q probabilities. At zero-probability outcomes, apply the standard limiting conventions rather than dividing by zero.
Why is nonnegative?
Under , define the density ratio:
Its expectation under is one:
Apply Jensen’s inequality to the convex function :
Therefore:
Equality is guaranteed when ; the converse needs stronger assumptions on .
Discrete f-divergence example
Let , , and
Ratios are . Then
Numerically this is about 0.1308 nats, which is nonnegative.
Reading the f-divergence formula without skipping steps
For a discrete sample space, replace the integral by a sum:
First choose the outcomes, then write the and values, calculate the ratios , apply f to each ratio, multiply by , and add. This is the same structure as the integral in the chapter, expressed as a small table of probabilities.
A different convex f
Choose
and . The ratios are 1.5 and 0.5. Their f-values are
and
Multiply each by its Q weight: . This is an illustration of the general f-divergence calculation, not an additional named divergence for the syllabus.
Conditions and common errors
The usual ratio formula requires care where ; do not divide by zero. For introductory finite examples we use strictly positive Q probabilities. Also, the function f must satisfy
and the convexity condition. If , every ratio equals 1, so
A complete calculation recipe for finite distributions
Step 1 — Check that P and Q are probability distributions: each entry is nonnegative and each row sums to 1. Both must describe the same outcomes in the same order.
Step 2 — For KL, compute the ratios and then the contributions . Sum the contributions. Use natural logarithms unless the question specifies another base.
Step 3 — For JS, form for each outcome. Compute and separately, then take their average.
Step 4 — For total variation, compute for each outcome, sum, and divide by two. There are no logarithms.
Final check — KL and JS are nonnegative; total variation lies between 0 and 1. A negative numerical KL usually signals an arithmetic error.
