Why $ \int_{-\infty}^{\infty}|x| e^{-|x|} d x=-\int_{-\infty}^{0} x e^{-x} d x+\int_{0}^{\infty} x e^{x} d x $ I dont understand why the following is true?
$$
=\int_{-\infty}^{\infty}|x| e^{-|x|}  d x=-\int_{-\infty}^{0} x e^{-x}  d x+\int_{0}^{\infty} x e^{x}  d x
$$
I thought it should be $$
=\int_{-\infty}^{\infty}|x| e^{-|x|}  d x=-\int_{-\infty}^{0} x e^{- (-x)}  d x+\int_{0}^{\infty} x e^{-x}  d x
$$
I am not sure I understand why the variable in the exponent is positive in the negative interval and vice versa

You are right. It's easy to check this since obviously $\displaystyle \int_{-\infty }^0 e^{-x} x \, dx$ and $\displaystyle  \int_{0}^{\infty} x e^{x}  d x$ diverges but the original integral $\displaystyle  \int_{-\infty}^{\infty}|x| e^{-|x|}  d x$ converges.
