Section 22.3 states that for a one-dimensional Gaussian code with mean and variance , compared with a standard normal prior, the KL divergence is Derive that formula from the definition using the Gaussian density. Then evaluate it at and at , and show that it is zero exactly when is the standard normal.
This tier asks for a derivation, so there is no automatic checker. Write your answer, then open the worked solution and compare.
Worked solution
The two densities are Their logarithms are Take the expectation under . The first term of is constant, and because is the variance of . So For , the variance identity gives . So Subtract: The two logarithms combine as . Collecting the remaining terms, That is the stated formula. At the logarithm is zero, so At , which is to four decimal places. The expression is a sum of two non-negative pieces, and , and the second is non-negative because for every with equality at . Both pieces vanish exactly when and , which is the standard normal. So the distance is zero at the prior and positive at every other Gaussian, as a divergence must be.