Solution (source code)

= Solution

The <moment-generating function> of a <random variable> $X$ is $M_X(t)=\mathbb E[e^{tX}]$ wherever this <expectation> is finite. Existence on an open interval containing zero is the condition needed for the usual uniqueness and convergence theorems. For the <exponential distribution> with rate $\lambda>0$,
$$
M_X(t)=\int_0^\infty\lambda e^{-(\lambda-t)x}\,dx
=\boxed{\frac\lambda{\lambda-t}\quad(t<\lambda)}.
$$
For $t\geq\lambda$ the integral diverges. Differentiating at zero gives mean $1/\lambda$ and <variance> $1/\lambda^2$.