# Moment generating function using linearity of expectation

Bit of help required with moment generating function.

If $X$ follows the distribution with moment generating function $M_X(t)$ and $Y = aX+b$.

Show that $M_Y(t) = e^{bt} M_X(at)$

So I understand from reading using linearity of expectation

• Step 1: $~M_Y(t) = E(e^{tY})$
• Step 2: $~E(e^{t(aX +b)})$
• Step 3: $~E(e^{atX} e^{tb})$
• Step 4: $~e^{tb} E(e^{atX})$
• Step 5: $~e^{bt} M_X(at)$

Step 3 -Why does $t$ go between $a$ and $X$ when multiplying out???

Step 4 - $e^{tb}$ moves out because it is constant??

Step 5 - How does this transition between step 4 and 5 happen?

Thanks

Step 3: For any two real numbers $a$ and $t$, $at = ta$ since multiplication is commutative, so $atX$ is the same as $taX$. The author likely just believed that $atX$ looks nicer than $taX$.
Step 4: Yes, $e^{tb}$ is a constant value for a fixed $t$ and $b$ and therefore $$E[e^{tb}e^{atX}] = e^{tb}E[e^{atX}]$$
Step 4 $\to$ Step 5: Remember that the moment generating function of $X$ is defined by $M_X(t) = E[e^{tX}]$, so looking at $E[e^{atX}]$ you can see this should be $M_X(at)$.