Calculation of the n-th central moment of the normal distribution $\mathcal{N}(\mu,\sigma^2)$

Since integration is not my strong suit I need some feedback on this, please:

Let $Y$ be $\mathcal{N}(\mu,\sigma^2)$, the normal distrubution with parameters $\mu$ and $\sigma^2$. I know $\mu$ is the expectation value and $\sigma$ is the variance of $Y$.

I want to calculate the $n$-th central moments of $Y$.

The density function of $Y$ is $$f(x)=\frac{1}{\sigma\sqrt {2\pi}}e^{-\frac{1}{2}\left(\frac{y-\mu}{\sigma}\right)^2}$$

The $n$-th central moment of $Y$ is $$E[(Y-E(Y))^n]$$

The $n$-th moment of $Y$ is $$E(Y^n)=\psi^{(n)}(0)$$ where $\psi$ is the Moment-generating function $$\psi(t)=E(e^{tX})$$

So I started calculating:


E[(Y-E(Y))^n]&=\int_\mathbb{R}\left(f(x)-\int_\mathbb{R}f(x)dx\right)^n\,dx \\
&=\int_\mathbb{R}\sum_{k=0}^n\left[\binom{n}{k}(f(x))^k\left(-\int_\mathbb{R}f(x)dx\right)^{n-k}\right]\,dx \\
&=\sum_{k=0}^n\binom{n}{k}\left(\int_\mathbb{R}\left[(f(x))^k\left(-\int_\mathbb{R}f(x)dx\right)^{n-k}\right]\,dx\right) \\
&=\sum_{k=0}^n\binom{n}{k}\left(\int_\mathbb{R}\left[(f(x))^k\left(-\mu\right)^{n-k}\right]\,dx\right) \\
&=\sum_{k=0}^n\binom{n}{k}\left((-\mu)^{n-k}\int_\mathbb{R}(f(x))^k\,dx\right) \\
&=\sum_{k=0}^n\binom{n}{k}\left((-\mu)^{n-k}E\left(Y^k\right)\right) \\

Am I on the right track or completely misguided? If I have made no mistakes so far, I would be glad to get some inspiration because I am stuck here. Thanks!

Solutions Collecting From Web of "Calculation of the n-th central moment of the normal distribution $\mathcal{N}(\mu,\sigma^2)$"

The $n$-th central moment $\hat{m}_n = \mathbb{E}\left( \left(X-\mathbb{E}(X)\right)^n \right)$. Notice that for the normal distribution $\mathbb{E}(X) = \mu$, and that $Y = X-\mu$ also follows a normal distribution, with zero mean and the same variance $\sigma^2$ as $X$.

Therefore, finding the central moment of $X$ is equivalent to finding the raw moment of $Y$.

In other words,
$$ \begin{eqnarray}
\hat{m}_n &=& \mathbb{E}\left( \left(X-\mathbb{E}(X)\right)^n \right) =
\mathbb{E}\left( \left(X-\mu\right)^n \right) = \int_{-\infty}^\infty \frac{1}{\sqrt{2\pi} \sigma} (x-\mu)^n \mathrm{e}^{-\frac{(x-\mu)^2}{2 \sigma^2}} \mathrm{d} x\\
& \stackrel{y=x-\mu}{=}& \int_{-\infty}^\infty \frac{1}{\sqrt{2\pi} \sigma} y^n \mathrm{e}^{-\frac{y^2}{2 \sigma^2}} \mathrm{d} y \stackrel{y = \sigma u}{=}
\int_{-\infty}^\infty \frac{1}{\sqrt{2\pi} \sigma} \sigma^n u^n \mathrm{e}^{-\frac{u^2}{2}} \sigma \mathrm{d} u \\
&=& \sigma^n \int_{-\infty}^\infty \frac{1}{\sqrt{2\pi} } u^n \mathrm{e}^{-\frac{u^2}{2}} \mathrm{d} u
The latter integral is zero for odd $n$ as it is the integral of an odd function over a real line. So consider
&& \int_{-\infty}^\infty \frac{1}{\sqrt{2\pi} } u^{2n} \mathrm{e}^{-\frac{u^2}{2}} \mathrm{d} u = 2 \int_{0}^\infty \frac{1}{\sqrt{2\pi} } u^{2n} \mathrm{e}^{-\frac{u^2}{2}} \mathrm{d} u \\
&& \stackrel{u=\sqrt{2 w}}{=} \frac{2}{\sqrt{2\pi}} \int_0^\infty (2 w)^n \mathrm{e}^{-w} \frac{\mathrm{d} w }{\sqrt{2 w}} = \frac{2^n}{\sqrt{\pi}} \int_0^\infty w^{n-1/2} \mathrm{e}^{-w} \mathrm{d} w = \frac{2^n}{\sqrt{\pi}} \Gamma\left(n+\frac{1}{2}\right)
where $\Gamma(x)$ stands for the Euler’s Gamma function. Using its properties we get
\hat{m}_{2n} = \sigma^{2n} (2n-1)!! \qquad\qquad
\hat{m}_{2n+1} = 0