Finding $\int_0^{\infty}xe^{-\lambda_1x} \, dx$ with integration by parts I'm returning to graduate school 20+ years after taking calculus. As part of a homework assignment in my statistics class, I need to find:
$$\int_0^\infty xe^{-\lambda_1x}\; dx$$
Finding this integral is one step in finding the expected value of a given continuous distribution function, whose solution is the answer to the homework question. 
Now, I've had a gentle nudge by the instructor that I should use integration by parts to solve this, but even that and some looking around online hasn't helped me. I found:
$$\int f(x) g'(x) \; dx = f(x) g(x) - \int f'(x) g(x) \;dx$$
or
$$\int u \,dv = uv - \int v\, du$$
Choosing $u, dv$ and solving for $du, v$, I get:
$$u=x, du = dx, dv=e^{-\lambda_1x} \, dx, v=\int e^{-\lambda_1x}=-\frac{1}{\lambda_1} e^{-\lambda_1x}$$
I am not at all certain that I got $v$ correct, but using that, I get:
$$\int xe^{-\lambda_1x} \, dx =\frac{-1}{\lambda_1}e^{-\lambda_1x}$$
But when I plug that back into the original formula to answer the original question, I get an answer that doesn't make sense.
Can you help me find my mistake?
 A: You have $u=x$, $du=dx$, $dv = e^{-\lambda_1x}dx$ and $v= -\frac{1}{\lambda_1}e^{-\lambda_1x}$
Plug those into the formula:
Formula: $\displaystyle \int u\,dv = uv - \int v \,du$
\begin{align*}
\int x e^{-\lambda_1x}dx &= x \left(-\frac{1}{\lambda_1}e^{-\lambda_1x}\right) - \int -\frac{1}{\lambda_1}e^{-\lambda_1x} dx \\ \\
&=x \left(-\frac{1}{\lambda_1}e^{-\lambda_1x}\right) -\frac{1}{(\lambda_1)^2}e^{-\lambda_1x}
\end{align*}
A: $$\int_0^\infty x e^{\alpha x} \,dx = \left.\left(\frac 1 \alpha x e^{ \alpha x}\right)\right|_0^\infty -\frac 1 \alpha \int_0^\infty e^{\alpha x} \, dx$$
From here it can be seen that the integral converges not for any arbitrary value of $\alpha$, but if it does (when?) the answer equals $\frac{1}{\alpha^{2}}$
A: $$
\int x \Big(e^{-\lambda x} \, dx\Big) = \overbrace{\int x\,dv = xv - \int v\,dx}^\text{integration by parts} = x \cdot \left(\frac 1 {-\lambda} e^{-\lambda x}\right)  - \int \left( \frac 1 {-\lambda} e^{-\lambda x} \right) \, dx \cdots\cdots
$$
and you've shown that you know how to find that last integral.
It's easy to find $\lim\limits_{x\to\infty} e^{-\lambda x}$ when $\lambda>0$, but then there is also the problem of finding
$$
\left. x\cdot \left( \frac 1 {-\lambda} e^{-\lambda x} \right) \right|_{x=0}^{x=\infty} = \lim_{x\to\infty} \left( x\cdot \frac 1 {-\lambda} e^{-\lambda x} \right) - 0.
$$
This can be done by L'Hopital's rule, by re-writing it as
$$
\frac 1 {-\lambda} \lim_{x\to\infty} \frac x {e^{\lambda x}}
$$
so the numerator and denominator both approach $\infty$.
L'Hopital's rule is very efficient but doesn't give any insight.  If you think about the nature of this last limit, it's not hard to figure out why it must be $0$ quite independently of L'Hopitals rule, and then you'll actually understand that.
