# Why is this the result of computing the expectaion of this variable

I was given the following example with a solution: But I do not understand how they got from step 2 top step 3, i.e how they computed the result of the expectaion function.

• It's already been given in the hint. – Cave Johnson Jun 11 '18 at 7:25

The definition of the MGF is $\forall t, M_Y(t) = E[e^{tY}]$.
Therefore, $E[e^{t\sigma Z}] = M_Z(t \sigma)$.
We know that $Z\sim\mathcal{N}(0,1)$, the hint gives you : $\forall x, M_Z(x) = e^{\frac{1}{2}x^2}$
Now, applying with $x = t\sigma$, you get : $$E[e^{t\sigma Z}] = e^{\frac{1}{2}(\sigma t)^2}$$
PS : There are two errors in your solution. If $Y = \sigma Z + \mu$, then $Y\sim \mathcal{N}(\mu,\sigma^2)$, and the lowercase $z$ should be uppercase.
Breaking it down, step by step, we have: \begin{align}\mathsf M_Y(t)&=\mathsf E(e^{tY}) &&\text{definition of MGF}\\[1ex]&= \mathsf E(e^{t(\sigma Z+\mu)})&&\text{substitution: }Y=\sigma Z+\mu\\[1ex]&=\mathsf E(e^{t\sigma Z}e^{t\mu})&&\text{rules of exponents}\\[1ex]&=e^{t\mu}\mathsf E(e^{(t\sigma)Z}) &&\text{linearity of expectation}\\[1ex] &=e^{t\mu}\mathsf M_Z(t\sigma) &&\text{definition of MGF}&&\mathsf M_Z(s)=\mathsf E(e^{sZ})\\[1ex] &= e^{t\mu} e^{(t\sigma)^2/2}&&\text{the hint you were given}&&\mathsf M_Z(s)=e^{s^2/2}\\[1ex] &=e^{t\mu+(t\sigma)^2/2}&&\text{rules of exponents}\\[2ex]&=e^{3t+2t^2}&&\text{substitution: }\mu=3,\sigma^2=4\end{align}