Gibbs variational principle for relative entropy (source code)

= Gibbs variational principle for relative entropy

For a <probability mass function> $Q$ of full support on a finite <alphabet> and a real function $g$,
$$
\log\mathbb E_Q e^g
=\sup_P\{\mathbb E_Pg-D_e(P\Vert Q)\},
$$
where $D_e$ uses <natural logarithms>. The unique maximizing <probability mass function> is the exponential tilt $P^*(x)=Q(x)e^{g(x)}/\mathbb E_Qe^g$.