How to compute moments of log normal distribution?

The computed moments of log normal distribution can be found here. How to compute them?

Solutions Collecting From Web of "How to compute moments of log normal distribution?"

If $X$ is lognormal, then $Y = \log X$ is normal. So consider $${\rm E}[X^k] = {\rm E}[e^{kY}] = \int_{y=-\infty}^\infty e^{ky} \frac{1}{\sqrt{2\pi}\sigma} e^{-(y-\mu)^2/(2\sigma^2)} \, dy. $$ Now observe that $$\begin{align*} ky – \frac{(y-\mu)^2}{2\sigma^2} &= – \frac{-2k\sigma^2 y + y^2 – 2\mu y + \mu^2}{2\sigma^2} \\ &= -\frac{1}{2\sigma^2}\left(y^2 – 2(\mu + k\sigma^2)y + (\mu + k \sigma^2)^2 + \mu^2 – (\mu + k \sigma^2)^2\right) \\ &= -\frac{\left(y – (\mu+k\sigma^2)\right)^2}{2\sigma^2} + \frac{k(2\mu + k \sigma^2)}{2}. \end{align*}$$ Thus the $k^{\rm th}$ raw moment is simply $${\rm E}[X^k] = e^{k(2\mu + k\sigma^2)/2} \int_{y=-\infty}^\infty \frac{1}{\sqrt{2\pi}\sigma} e^{-(y – \mu’)^2/(2\sigma^2)} \, dy,$$ where $\mu’ = \mu + k \sigma^2$. But this latter integral is equal to 1, being the integral of a normal density with mean $\mu’$ and variance $\sigma^2$. So ${\rm E}[X^k] = e^{k(2\mu + k\sigma^2)/2}$. The variance of $X$ is then easily calculated from ${\rm Var}[X] = {\rm E}[X^2] – {\rm E}[X]^2$.

In fact, the expression for the $k^{\rm th}$ raw moment of $X$ that we derived is actually also the moment generating function of $Y = \log X$.


Addendum. A somewhat different computation can be made from the observation that $$\frac{Y – \mu}{\sigma} = Z \sim \operatorname{Normal}(0,1),$$ so $$\operatorname{E}[X^k] = \operatorname{E}[e^{kY}] = \operatorname{E}[e^{k(\sigma Z + \mu)}] = e^{k \mu + (k \sigma)^2/2} \operatorname{E}[e^{(k\sigma) Z – (k\sigma)^2/2}].$$ Then $$\operatorname{E}[e^{(k \sigma) Z – (k \sigma)^2/2}] = \int_{z=-\infty}^\infty \frac{e^{-z^2/2 + (k \sigma) z – (k \sigma)^2/2}}{\sqrt{2\pi}} \, dz = \int_{z=-\infty}^\infty \frac{e^{-(z-k\sigma)^2/2}}{\sqrt{2\pi}} \, dz = 1,$$ and the result is proven.