Evaluation of integral $\int_{-\infty}^{+\infty} xe^{-|x|}\,dx$ is not $0$ Given $$f(x)=\frac12e^{-|x|},  -\infty \le x \le +\infty$$
$$\int_{-\infty}^{+\infty} x f(x)\, dx= -\frac12\int_{-\infty}^{+\infty} x (-e^{-|x|})' dx=-\frac12\bigg(-xe^{-|x|} + \int_{-\infty}^{+\infty}e^{-|x|} dx\bigg) $$
$$=\frac12(xe^{-|x|}+e^{-|x|}|_{-\infty}^{+\infty}) = \frac12xe^{-|x|}$$  
I know the final result is not correct, but help me on this as I am unable to resolve it by any means.
 A: $$
\begin{align}
\int_{-\infty}^{\infty}x\mathrm{e}^{-|x|}dx & = \int_{-\infty}^{0}x\mathrm{e}^{x}dx + \int^{\infty}_{0}x\mathrm{e}^{-x}dx \\[6pt]
& =\int_{\infty}^{0}x\mathrm{e}^{-x}dx + \int^{\infty}_{0}x\mathrm{e}^{-x}dx \\[6pt]
& =-\int^{\infty}_{0}x\mathrm{e}^{-x}dx + \int^{\infty}_{0}x\mathrm{e}^{-x}dx \\[6pt]
& =0
\end{align}
$$
A: \begin{align}
\int_0^\infty x \Big( e^{-x}\,dx\Big) & = \int x\,dv = xv-\int v\,dx \\[8pt]
& = \left.-xe^{-x}\vphantom{\frac11}\right|_0^\infty - \int_0^\infty -e^{-x}\,dx \\[8pt]
& = \left.\left(-xe^{-x} - e^{-x}\right)\vphantom{\frac11}\right|_0^\infty.
\end{align}
It is easy to evaluate this expression at $x=0$.  To "evaluate it at $\infty$" is to find its limit as $x\to\infty$.  In the case of the second term that is clearly $0$.  The first term can be handled by L'Hopital's rule applied to $x/e^x$.
L'Hopital's rule often gives answers very fast without giving insight.  You might think about a common sense reason why you would expect $\lim\limits_{x\to\infty} x/e^x$ to be $0$ by means having nothing to do with L'Hopital's rule.
So we see that the integral above is $1$.  In the same way, we can see that
$$
\int_{-\infty}^0 x e^x\,dx=-1.
$$
Consequently
$$
\int_{-\infty}^\infty xe^{-|x|}\,dx = 1 + (-1).
$$
A: When you evaluate $x e^{-|x|}$ in $x=\pm\infty$ you get zero.
By the way, 
$$\int_{-\infty}^{+\infty} x e^{-|x|}\,dx = 0$$
since $x e^{-|x|}$ is an odd function that belongs to $L^1(\mathbb{R})$.
