# Compute the moment generating function of $X$ [closed]

Suppose that $X$ has density function $$f(x) = e^{−x}, \quad x > 0.$$ Compute the moment generating function of $X$ and use your result to determine its mean and variance. Check your answer for the mean by a direct calculation

My attempt: \begin{align*} f(x) & = e^{-x} \\ M(t) & = \int_0^\infty e^{tx}f(x) ~dx \\ & = \int_0^\infty e^{tx}e^{-x} ~dx \\ & = \int_0^\infty e^{x(t - 1)} ~dx \\ & = \left. \frac{e^{x(t - 1)}}{t - 1} \right|_{t = 0}^\infty \\ & = \frac{1}{1 - t}, \text{ for } t < 1. \\ M'(t) & = \frac{1}{1 - t}. \\ E[X] & = M'(0) = 1. \\ M''(t) & = \frac{2}{(1 - t)^3}. \\ E[X^2] & = M''(0) = 2. \\ \mathrm{Var}(X) & = E[X^2] - (E[X])^2 = 2 - 1^2 = 1. \\ \end{align*} To check those answers, evaluate these integrals: \begin{align*} E[X] & = \int_0^\infty xe^{-x} ~dx = 1. \\ E[X^2] & = \int_0^\infty x^2 e^{-x} ~dx = 2. \end{align*}

Is it right to my procedure?

-
I don't see a question here. –  Qiaochu Yuan May 21 '12 at 0:37
If your question is whether the mgf is $1/(1-t)$, the answer is that it is. For finding $E(X)$, $E(X^2)$ by direct integration, use integration by parts. –  André Nicolas May 21 '12 at 0:43
Is it right to my procedure? –  Daniela del Carmen May 21 '12 at 0:46
@Henry T. Horton: Nice job of making the post look good. –  André Nicolas May 21 '12 at 0:47
@Daniela del Carmen: Your mgf calculation is fine (as interpreted by Henry T. Horton), also the calculation of mean, variance from the mgf. To answer the question fully, you are being asked also to find the two expectations directly. –  André Nicolas May 21 '12 at 0:50
show 3 more comments

## closed as not constructive by Marvis, Did, Jennifer Dylan, Asaf Karagila, t.b.Aug 18 '12 at 11:58

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.