Integral of an absolute value

31.3k Views Asked by At

I am trying to evaluate the integral $$\int_{-1}^2 (x-2|x|)\,dx$$

I know that this should give me $x^2 /2 - x^2$ for the antiderivative.

I then evaluate at $2$ which gives me $2 - 4 = -2$

Then evaluate at $-1$ and get $\frac{1}{2} - 1 = -\frac{1}{2}$.

Then I find the difference $-2 - \frac{1}{2} = -2.5$

This is wrong and I do not know why.

2

There are 2 best solutions below

2
On BEST ANSWER

You should consider splitting the integral at the point where $|x|$ changes from $-x$ to $+x$, namely at $x=0$. So $$ \int_{-1}^2(x-2|x|)dx = \int_{-1}^0(x-2(-x))dx + \int_0^{2}(x-2x)dx $$ $$ =3\int_{-1}^0 xdx -\int_0^2xdx $$

which are integrals you should be able to evaluate.

4
On

Hint

$$|x|=\begin{cases} -x, &x \le 0\\x. &x \ge 0\end{cases}$$

So, $$\begin{align}\int_{-1}^2|x|\; \mathrm{d} x&=\int_{-1}^0|x| \;\mathrm{d}x+\int_0^2|x| \;\mathrm{d}x\\&=?\end{align}$$