# 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.

• Let $f\colon [-2\pi, 2\pi]\to \mathbb R, x\mapsto xe^{-|x|}$. You should know by now that $\displaystyle \int \limits_{-2\pi}^{2\pi}f=\int \limits_{-2\pi}^{0}f+\int \limits_{0}^{2\pi}f$ and also $\forall x\in [-2\pi, 0]\left(f(x)=xe^{-(-x)}\right)$. – Git Gud Sep 15 '14 at 10:29
• @GitGud What if there is a modulus and the bounds of the integral are both positive? – robertmartin8 Sep 15 '14 at 10:30
• @ surelyyourjoking. Then $x$ would only ever be a positive value (or zero) and so the modulus can be replaced simply by $x$ alone since $\mid x\mid\geq 0$ for all $x$. – Pixel Sep 15 '14 at 10:50
• ah I see, so the modulus is meaningless in an indefinite integral? – robertmartin8 Sep 15 '14 at 11:24
• No, the modulus is not meaningless for indefinite integrals. When considering definite integrals as your question does we have bounds on the integral, which tells us the domain of the integrand to consider. Because we know the domain, we also know the sign (positive/negative) of a given $x$ value. Hence we can then split the integral into positive/negative parts to evaluate it. Notice also that an indefinite integral can be written as a definite integral since $$\int f(x)dx = \int_\lambda^x f(t)dt,$$ where the "lower bound" $\lambda$ gives a constant of integration. – Pixel Sep 15 '14 at 12:00

$$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.

$$\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.

• Alright, I understand it for this example now. But in general? when the bounds of the integral are both positive? – robertmartin8 Sep 15 '14 at 10:35
• @ surelyyourjoking. Then $x$ would only ever be a positive value (or zero) and so the modulus can be replaced simply by $x$ alone since $∣x∣≥0$ for all $x$. – Pixel Sep 15 '14 at 10:58

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.

• so this works even when the bounds of the integral are both positive? – robertmartin8 Sep 15 '14 at 10:34
• Sure, why not? You have to pay attention where to split the integral. Try splitting $$\int_{-2}^3 |x - 1|e^x \ \mathrm{d}x$$ to see if you can do it (you don't need to solve it, that's not the point here) – Ivo Terek Sep 15 '14 at 10:36

$|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.

• I understand that you have to split it up into cases, I just dont get technically how or why this is done – robertmartin8 Sep 15 '14 at 10:33