\documentclass[a4paper,12pt]{article}
\begin{document}
\parindent=0pt

{\bf Question}

Suppose that $X$ follows the exponential distribution, i.e.
$f(x)=e^{-x},\ x>0$.  Obtain the mgf of this distribution and show
that $E(X^k)=k!$ where $k$ is a positive integer.  Verify this
result using direct integration.

\medskip

{\bf Answer}

\begin{eqnarray*} M_X(t) & = & E(e^{tX})\\ & = & \int_0^\infty
e^{tx} e^{-x} \,dx\\ & = & \frac{1}{1-t},\ \ \ t<1\\ & = & 1 + t +
t^2 + t^3 + ...\ {\rm valid\ for}\ |t|<1.\ \end{eqnarray*}

However
\begin{eqnarray*} E(X^k) & = & \left.\frac{d^k
M_X(t)}{dt^k}\right|_{t=0}\\ & = & \left.k! + \frac{(k+1)!}{1!}t +
\frac{(k+1)!}{2!}t^2 +... \right|_{t=0}\\ & = & k! \end{eqnarray*}

(See this by taking k=1,2,3, and so on)


Alternative:
\begin{eqnarray*} E(X^k)&=&\int_0^{\infty}x^k e^{-x} f(x) \,dx\\ & =
& \left.-x^k e^{-x}\right|_0^\infty + \int_0^\infty k
x^{k-1}e^{-x} \,dx\ \ [{\rm Integration\ by\ parts}]\\ & = &
k\int_0^\infty x^{k-1}e^{-x} \,dx\\ & \vdots & \\ & = & k!
\int_0^\infty e^{-x} \,dx\\ & = & k! \end{eqnarray*}
\end{document}
