For X ~ N(0, σ²), compute E[X²] and E[eˣ] and explain your technique. Then state the change-of-variables formula for densities and where it appears in ML.
Answer
Model answer, written in a candidate's voice
In short
- E[X^2] = sigma^2 by definition of variance with mean 0.
- E[e^X] = exp(sigma^2/2) via the normal MGF or completing the square.
- Change of variables: p_Y(y) = p_X(g^{-1}(y)) * |det J_{g^{-1}}(y)|.
- ML uses: normalising flows, reparameterisation trick, log-normal distributions.
In full
For X ~ N(0, sigma^2), E[X^2] is just the variance, so E[X^2] = sigma^2. For E[e^X], I use the normal moment-generating function: E[e^{tX}] = exp(mu t + sigma^2 t^2/2), and setting mu = 0 and t = 1 gives E[e^X] = exp(sigma^2/2); equivalently, completing the square in the integral gives the same result. The change-of-variables formula says that if Y = g(X) for a differentiable bijection g, then p_Y(y) = p_X(g^{-1}(y)) * |det J_{g^{-1}}(y)|, where J is the Jacobian. In ML this appears in normalising flows, where exact likelihoods are computed by pushing a simple base density through invertible transformations; in the reparameterisation trick, where X = mu + sigma * Z with Z ~ N(0, I) is used to make expectations differentiable; and in log-normal distributions, where Y = e^X for normal X has density p_Y(y) = p_X(log y)/y for y > 0.
What a strong answer covers
- E[X²] = σ².
- E[eˣ] = e^{σ²/2}, by completing the square or using the moment-generating function.
- Change of variables: p_Y(y) = p_X(g⁻¹(y))·|det J_{g⁻¹}(y)|.
- Uses: normalising flows, reparameterisation, log-normal distributions.
Common mistakes
- Dropping the Jacobian determinant.
- Writing E[eˣ] = e^{E[X]}, which ignores Jensen’s inequality.