Finding the definite integral of a function that contains an absolute value 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. 
 A: $$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.
A: $$\int_{-2\pi}^{2\pi}xe^{-\left|x\right|}dx=\int_{-2\pi}^{0}xe^{-\left|x\right|}dx+\int_{0}^{2\pi}xe^{-\left|x\right|}dx=\int_{-2\pi}^{0}xe^{x}dx+\int_{0}^{2\pi}xe^{-x}dx$$
This is a split of cases killing the annoying modulus.
A: If you have a function $f: [a,b] \to \Bbb R$ defined by parts, as in: $$f(x) = \begin{cases} f_1(x), \mbox{if } a \leq x \leq c \\ f_2(x), \mbox{if } c < x \leq b\end{cases}$$
then: $$\int_a^b f(x) \ \mathrm{d}x = \int_a^c f_1(x) \ \mathrm{d}x + \int_c^bf_2(x) \ \mathrm{d}x.$$
In your case, $f(x) = xe^{-|x|}$, so $c = 0$ and $f_1(x) = xe^{x}$ and $f_2(x) = xe^{-x}$, using the definition of absolute value. Remember the interpretation  of the integral for a positive function: the integral is the area, so the sum of the areas is the sum of integrals.
A: $|x|=x$ for x>0
and = -x for x<0
and 0 for x=0
since x is positive and negative in the limits $-2\pi$ to $2\pi$ you have to split it into two parts and then evaluate your integral.
So in this function you are splitting into cases for |x| where x>0 and x<0.
this is done because |x| is defined that way in its domain.since you get two different functions for different intervals in the domain, you have to consider two different limits. imagine a function 
f(x)=0 for x<0 
and 1 for x>0
and we are evaluating an integral $\int{xf(x)}dx$ with limits -1 to 1.
so because of the definition of f(x) you have to split the integral into two.
here its just two integrals sometimes you have to split into many more.
