<s>[INST] Calculate $E[|X^{k}|]$ when k is odd, $X$ is a random variable with standard normal distribution I want to calculate $E[|X^{k}|]$ when k is odd, $X$ is a random variable with standard normal distribution. My approach is as follows.
Since $E[X^{k}]=0$ when $k$ is odd. We have $$E[X^{k}] = 0 = \int_{-\infty}^{\infty}x^{k}(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})dx = \int_{-\infty}^{\infty}(x^{k})^{+}(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})dx - \int_{-\infty}^{\infty}(x^{k})^{-}(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})dx$$, where $(x^{k})^{+} = x^{k}$ when $x^{k}\geq 0$ and $0$ otherwise. $(x^{k})^{-} = -x^{k}$ when $x^{k}\leq 0$ and $0$ otherwise.
From the above identity, we have $$\int_{-\infty}^{\infty}(x^{k})^{+}(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})dx = \int_{-\infty}^{\infty}(x^{k})^{-}(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})dx$$
Now $$E[|X^{k}|] = \int_{-\infty}^{\infty} ((x^{k})^{+} + (x^{k})^{-})(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})d = 2\int_{-\infty}^{\infty}(x^{k})^{+}(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})dx$$
Since $(x^{k})^{+}=0$ when $x\in[-\infty,0)$, we can write
$$E[|X^{k}|] = 2\int_{0}^{\infty}x^{k}(\frac{1}{\sqrt{2\pi}}e^{\frac{-x^{2}}{2}})dx$$
Let $A_{k} = \int_{0}^{\infty}x^{k}(\frac{1}{\sqrt{2\pi}} e^{\frac{-x^{2}}{2}}) dx = \frac{1}{\sqrt{2\pi}} \int_{0}^{\infty}x^{k} (e^{\frac{-x^{2}}{2}}) dx$.
We use integration by parts. Take $u=x^{k-1}, dv = xe^{\frac{-x^{2}}{2}}$, then $du=(k-1)x^{k-2}, v = -e^{\frac{-x^{2}}{2}}$.
Thus
$$A_{k} = \frac{1}{\sqrt{2\pi}}(-x^{k-1} e^{\frac{-x^{2}}{2}}\Big|_{0}^{\infty} + (k-1)\int_{0}^{\infty}x^{k-2} (e^{\frac{-x^{2}}{2}}) dx) = (k-1)A_{k-2}$$
Since $A_{1} = 1$, we have $E[|X^{k}|] = 2A_{k} = 2((k-1)(k-3)\cdots 1)$.
I think my approach is wrong since using my solution, $E[|X^{5}|]=16$ and $E[|X^{6}|]=15$. I want to ask which step is wrong? Any help is appreciated, thank you.
 [/INST] Let $k$ be a positive integer and $$I(k) = \int_{x=0}^\infty x^{2k-1} e^{-x^2/2} \, dx.$$  Then the substitution
$$u = x^2/2, \quad du = x \, dx$$ gives
$$I(k) = \int_{u=0}^\infty (2u)^{k-1} e^{-u} \, du = 2^{k-1} \int_{u=0}^\infty u^{k-1} e^{-u} \, du = 2^{k-1} \Gamma(k).$$  So we have
$$\operatorname{E}[|X^{2k-1}|] = \frac{2}{\sqrt{2\pi}} I(k) = \frac{2^k \Gamma(k)}{\sqrt{2\pi}}.$$  A table for the first few values of $k$ are as follows:
$$\begin{array}{c|c|c}
k & 2k-1 & \operatorname{E}[|X^{2k-1}|] \\
\hline
1 & 1 & \sqrt{\frac{2}{\pi}} \\
2 & 3 & 2 \sqrt{\frac{2}{\pi}} \\
3 & 5 & 8 \sqrt{\frac{2}{\pi}} \\
4 & 7 & 48 \sqrt{\frac{2}{\pi}} \\
\end{array}$$
</s>