[Math] Finding the definite integral of a function that contains an absolute value

absolute valuecalculusdefinite integralsintegration

The integral in question is this:

$\int_{-2\pi}^{2\pi}xe^{-|x|}$

My attempt:

Since there is a modulus, we split it up into cases. I'm not really sure which cases to split it into, do I just separately integrate these two functions?

$\int_{-2\pi}^{2\pi}xe^{-x}$

$\int_{-2\pi}^{2\pi}xe^{x}$

Or do I split it into these two?
$\int_{0}^{2\pi}xe^{-x}$
$\int_{-2\pi}^{0}xe^{x}$

I am leaning towards the second split (splitting the bounds of the integral), which seems better.

The question is:
What does it mean by 'splitting it into cases', and why does it work?
Another side question I have is how to differentiate a function that has a modulus somewhere inside it.

Best Answer

$$I=\int_{-2\pi}^{2\pi} xe^{-\mid x\mid}dx.$$

Loosely speaking, you can think about the definite integral as the area bounded by the function $xe^{-\mid x\mid}$ and the $x$-axis, as the variable $x$ moves from $x=-2\pi$ to $x=0$ then from $x=0$ through to $x=2\pi$. So, intuitively it's not too much of a step to see that $$I=\int_{-2\pi}^{0} xe^{-\mid x\mid}dx+\int_{0}^{2\pi} xe^{-\mid x\mid}dx.$$ Notice in the left integral the $x$ values are only ever negative or zero, and in the right integral the $x$ values are only ever positive or zero, so we can rewrite the whole expression $$I=\int_{-2\pi}^{0} xe^{x}dx+\int_{0}^{2\pi} xe^{-x}dx,$$ since $-|x|=x$ for $x\leq 0$ and $-|x|=-x$ for $x\geq 0$. You can now evaluate the integrals separately to obtain the correct result. Hope this helps.

Related Question