I need help with understanding the proof of expectation of exponential distribution:
$$\begin{align} E(X) & = \int_0^\infty x\lambda e^{-\lambda x}dx\\ & = [-xe^{-\lambda x}]_0^\infty + \int_0^\infty e^{-\lambda x}dx\\ & = (0-0) + [-\frac{1}{\lambda} e^{-\lambda x}]_0^\infty\\ & = 0 + \left(0 + \frac{1}{\lambda}\right)\\ & = \frac{1}{\lambda}\\ \end{align}$$
I found myself having problems with substituting the limits into $[-xe^{-\lambda x}]$. It probably doesn't make sense using l'hopital's rule here, but I tried anyway, and ended up with $\dfrac{1}{\lambda}$ instead of $0$.
Could any kind soul please show me how to substitute the limits? Thank you!
Applying de l'Hopital you get
$ \frac{-1}{\lambda \cdot e^{\lambda x}} $
which goes to $0$. You need to pay attention to the derivative of the exponential.