The moment-generating function of a random variable $W$ is defined as $ M_{W}(x)=e^\frac{x^2}{2}$.
Find a general expression for the even and odd moments of W.
My attempt:
$$m^{(1)}(x) = xe^{\frac{x^2}{2}}$$ $$m^{(2)}(x) = e^{\frac{x^2}{2}}(x^2+1)$$ $$m^{(3)}(x) = e^{\frac{x^2}{2}}x\left(x^2+3\right)$$ $$m^{(4)}(x) = e^{\frac{x^2}{2}}\left(x^4+6x^2+3\right)$$ $$m^{(5)}(x) = e^{\frac{x^2}{2}}x\left(x^4+10x^2+15\right)$$ $$m^{(6)}(x) = e^{\frac{x^2}{2}}\left(x^6+15x^4+45x^2+15\right)$$
We have:
$$m^{(1)}(0) = 0$$ $$m^{(2)}(0) = 1$$ $$m^{(3)}(0) = 0$$ $$m^{(4)}(0) = 3$$ $$m^{(5)}(0) = 0$$ $$m^{(6)}(0) = 15$$
I guess the general formula for the odd moments is just $0$. For the even numbers, I'm not sure how should I proceed with this one I wonder? Any methods or theorems I should apply?
Hint: The moment generating function of a random variable $Y$ is $E(e^{tY})$, which is $$1+\frac{E(Y)}{1!}t+\frac{E(Y^2)}{2!}t^2+\frac{E(Y^3)}{3!}t^3+\frac{E(Y^4)}{4!}t^4+\cdots.\tag{1}$$ Now expand $e^{t^2/2}$ in a power series. We get $$1+\frac{1}{2\cdot 1!}t^2+\frac{1}{2^2\cdot 2!}t^4+\frac{1}{2^3\cdot 3!}t^6+\cdots.\tag{2}$$ Compare (1) and (2) to write down the answers to your question.