# Integrate $\int_0^\infty e^{-t}|x-t|dt$.

How to integrate $$\int_0^\infty e^{-t}|x-t|dt$$?

I tried writing it as: $$\int_0^x e^{-t}(x-t)dt$$ $$-\int_x^\infty e^{-t}(x-t)dt$$. How do I proceed further?

• You’ve got the right idea. Just use integration by parts now. But i think the minus sign should be on the right integral. – Ryan Greyling Aug 6 at 16:54
• @YuriyS Yes, I just noticed. – Tapi Aug 6 at 16:55
• As a hint, can you do the indefinite integral $\int e^{-t} t dt$. As another hint, you can do it using integration by parts – Yuriy S Aug 6 at 16:55

You have that

$$\int_0^\infty e^{-t}|x-t|~dt= \int_0^x e^{-t}(x-t)~dt-\int_x^\infty e^{-t}(x-t)~dt$$

so you can further break up the integrals on the RHS by

\begin{align}\int_0^x e^{-t}(x-t)~dt-\int_x^\infty e^{-t}(x-t)~dt &= x\int_0^x e^{-t}~dt-\int_0^x e^{-t}t~dt-x\int_x^\infty e^{-t}~dt + \int_x^\infty e^{-t}t~dt\end{align}

where

$$x\int_0^x e^{-t}~dt = x\Big(\sinh(x) - \cosh(x) + 1\Big)$$

since $$e^{x}=\sinh(x) + \cosh(x) \implies -e^{-x}=\sinh(x) - \cosh(x)$$ and

$$x\int_x^{\infty} e^{-t}~dt = x\Big(e^{-x}\Big)$$

because $$1/e^{\infty}$$ is zero. To evaluate the remaining two integrals, I would apply integration by parts and set $$u=t$$ and $$dv=e^{-t}dt$$.