Finding a Moment Generating Function where the density function has $e$ in it

integrationprobabilityprobability distributionsproof-verification

Problem:
Consider a r.v. $X$ with pdf
\begin{eqnarray*}
f_x(x) &=& \frac{e^{ -\frac{(x+7)^2}{32} }}{ \sqrt{32\pi} }
\,\,\, -\infty < x < \infty \\
\end{eqnarray*}
Find the moment generating function of $X$.
Answer:
\begin{eqnarray*}
M_x(t) &=& E(e^{tX}) =
\int_{-\infty}^{\infty} e^{tx} \frac{e^{ -\frac{(x+7)^2}{32} }}{ \sqrt{32\pi} }
\,\, dx \\
M_x(t) &=&
\int_{-\infty}^{\infty}
e^{tx} \frac{e^{ -\frac{x^2+14x+49}{32} }}{ \sqrt{32\pi} } \,\, dx =
\int_{-\infty}^{\infty}
\frac{e^{ -\frac{x^2+32tx+14x+49}{32} }}{ \sqrt{32\pi} } \,\, dx
\\
\end{eqnarray*}
Is what I have done so far right? If it is, how do I perform the integration?
Thanks,
Bob

Here is my second attempt to solve the problem. This time, I come up with the answer, but I come up with the wrong answer. I am hoping somebody can tell me where I went wrong.

Answer:
\begin{eqnarray*}
M_x(t) &=& E(e^{tX}) =
\int_{-\infty}^{\infty} e^{tx} \frac{e^{ -\frac{(x+7)^2}{32} }}{ \sqrt{32\pi} }
\,\, dx \\
M_x(t) &=&
\int_{-\infty}^{\infty}
e^{tx} \frac{e^{ -\frac{x^2+14x+49}{32} }}{ \sqrt{32\pi} } \,\, dx =
\int_{-\infty}^{\infty}
\frac{e^{ -\frac{x^2-32tx+14x+49}{32} }}{ \sqrt{32\pi} } \,\, dx
\\
\end{eqnarray*}
Now to perform this integration, we complete the square:
\begin{eqnarray*}
x^2 – 32tx + 14x + 49 &=& (x + 7 – 16t)^2 – 256t^2 + 224t \\
M_x(t) &=&
\int_{-\infty}^{\infty}
\frac{e^{ -\frac{(x + 7 – 16t)^2 – 256t^2 + 224t}{32} }}{ \sqrt{32\pi} } \,\, dx
\\
M_x(t) &=&
e^{8t^2-7t} \int_{-\infty}^{\infty}
\frac{e^{ -\frac{(x + 7 – 16t)^2 }{32} }}{ \sqrt{32\pi} }
\,\, dx \\
\end{eqnarray*}
Now to preform the integration, let $u = x + 7 – 16t$ and that makes the integral
like the one for the normal distribution.
\begin{eqnarray*}
\int_{-\infty}^{\infty} \frac{e^{ -\frac{(x + 7 – 16t)^2 }{32} }} \,\, dx &=& 0 \\
M_x(t) &=& 0 \\
\end{eqnarray*}
Thanks,
Bob

Best Answer

In the last step you forgot the minus sign in front of $32 t x$, everything else looks fine. The idea for the integration is to complete the square in the exponent: $$ x^2 + 2 (7 - 16t) x + 49 = (x + 7 - 16t)^2 - 256 t^2 + 224 t \, .$$ Then you are left with a standard Gaussian integral: $$ M_X (t) = \mathrm{e}^{8 t^2 - 7 t} \int \limits_{-\infty}^\infty \frac{\mathrm{e}^{-(x + 7 - 16 t)^2 /32}}{\sqrt{32 \pi}} \, \mathrm{d} x \, . $$