Theorem 1 (The log evidence is the ELBO plus a divergence) Let \({\mathbb{p}\mathopen{}\left(x, z\right)\mathclose{}}\) and \(q\) be as in Definition 1. Let \({\mathbb{p}\mathopen{}\left(x\right)\mathclose{}} = \sum_z {\mathbb{p}\mathopen{}\left(x, z\right)\mathclose{}}\) be the evidence of the data, also called its marginal likelihood. The evidence is nonzero, because a data value \(x\) was observed. Then the logarithm of the evidence is the ELBO of \(q\) plus the Kullback–Leibler divergence of \(q\) from the posterior:
\[{\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x\right)\mathclose{}}\right\}\mathclose{}} = \mathrm{ELBO}(q) + {{D_{\mathrm{KL}}}\mathopen{}\left(q \,\Vert\, {\mathbb{p}\mathopen{}\left(\cdot \mid x\right)\mathclose{}}\right)\mathclose{}}.\]
Proof. Let \(z\) be a value with \(q(z) > 0\). Then \({\mathbb{p}\mathopen{}\left(z \mid x\right)\mathclose{}} \ne 0\), and \({\mathbb{p}\mathopen{}\left(x, z\right)\mathclose{}} = {\mathbb{p}\mathopen{}\left(z \mid x\right)\mathclose{}} \, {\mathbb{p}\mathopen{}\left(x\right)\mathclose{}}\). Apply \(\operatorname{log}\) to both sides and rearrange:
\[{\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x\right)\mathclose{}}\right\}\mathclose{}} = {\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x, z\right)\mathclose{}}\right\}\mathclose{}} - {\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(z \mid x\right)\mathclose{}}\right\}\mathclose{}}.\]
Add and subtract \({\operatorname{log}\mathopen{}\left\{q(z)\right\}\mathclose{}}\) on the right:
\[{\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x\right)\mathclose{}}\right\}\mathclose{}} = \mathopen{}\left({\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x, z\right)\mathclose{}}\right\}\mathclose{}} - {\operatorname{log}\mathopen{}\left\{q(z)\right\}\mathclose{}}\right)\mathclose{} + \mathopen{}\left({\operatorname{log}\mathopen{}\left\{q(z)\right\}\mathclose{}} - {\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(z \mid x\right)\mathclose{}}\right\}\mathclose{}}\right)\mathclose{}.\]
Multiply both sides by \(q(z)\), then sum over the values \(z\) with \(q(z) > 0\). The left side sums to \({\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x\right)\mathclose{}}\right\}\mathclose{}}\), because \(q\) sums to \(1\):
\[{\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x\right)\mathclose{}}\right\}\mathclose{}} = \sum_z q(z) \mathopen{}\left({\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(x, z\right)\mathclose{}}\right\}\mathclose{}} - {\operatorname{log}\mathopen{}\left\{q(z)\right\}\mathclose{}}\right)\mathclose{} + \sum_z q(z) \mathopen{}\left({\operatorname{log}\mathopen{}\left\{q(z)\right\}\mathclose{}} - {\operatorname{log}\mathopen{}\left\{{\mathbb{p}\mathopen{}\left(z \mid x\right)\mathclose{}}\right\}\mathclose{}}\right)\mathclose{}.\]
The first sum is \(\mathrm{ELBO}(q)\) by its definition. The second sum is \({{D_{\mathrm{KL}}}\mathopen{}\left(q \,\Vert\, {\mathbb{p}\mathopen{}\left(\cdot \mid x\right)\mathclose{}}\right)\mathclose{}}\) by the definition of the divergence.