# Expected value of exponential distribution with integration by parts (non-textbook way)

I try to calculate expected value of exponential distribution with integration by parts without success. I know that the text book way to do it so that first take lambda out of the integral and then do the integration by parts. What if I would like to calculate it directly: \begin{align} E[X]=\int_{0}^\infty x\lambda e^{-\lambda x} dx \end{align} And now \begin{align} f(x)=x, \quad f'(x)=dx \end{align} and \begin{align} g'(x)=-\lambda e^{-\lambda x}dx, \quad g(x)= e^{-\lambda x} \end{align} So I would like to start with \begin{align} E[X]=-\int_{0}^\infty x (-\lambda e^{-\lambda x}) dx. \end{align} Is this possible and if not why not?

• I mean sure, but its exactly what you started with. You haven't made any real progress. Apr 16 at 14:02
• Choose $u(x)=x$ and $v^{'}(x)=-\lambda e^{-\lambda x}$. Then it works. Advice: Take care of the signs (+,-). Apr 16 at 14:05
• I think this is exactly what I try to do and the question is how it works. Apr 16 at 14:06
• @Parallax Give a reply whether you succeeded or not. Apr 16 at 14:14
• I didn't. I will add my calculations to my question. Apr 16 at 14:21

In this case it is much easier to use the fact (which follows from Tonelli's theorem) that for a non-negative random variable $$X$$ with finite mean, $$\mathbb E[X] = \int_0^\infty (1-F_X(x))\ \mathsf dx$$, with $$F_X$$ being the distribution function of $$X$$. Hence $$\mathbb E[X] = \int_0^ \infty e^{-\lambda t}\ \mathsf dt = \frac1\lambda.$$