Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
up vote 6 down vote accepted

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.

share|cite|improve this answer
I dont follow what happend to the 0 to 2 (x-2x)dx part, where did the 3 go? – user138246 Apr 22 '12 at 3:15
In the range $-1 \leq x \leq 0$ we have that $|x| = -x$, so I substitute $(-x)$ where $|x|$ was in the first integral. Then $x-2(-x) = 3x$ which is where $3\int_{-1}^0xdx$ comes from. Similarly, in the range $0 \leq x \leq 2$ we have that $|x| = x$, so I replace $|x|$ by $x$ in the second integral. Then $x-2x = -x$, which is where $-\int_0^2xdx$ comes from. – nullUser Apr 22 '12 at 3:20


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

share|cite|improve this answer
I do not know what that really means, x will always be positive. – user138246 Apr 22 '12 at 3:12
No, @Jordan. $x$ is negative when $-1 \le x \lt 0$. This is the reason why the integral of $|x|$ is different from $x$... – user21436 Apr 22 '12 at 3:14
I thought absolute value meant that the value of that number is always positive. – user138246 Apr 22 '12 at 3:15
Will convince you on chat @Jordan – user21436 Apr 22 '12 at 3:17
|x| will be positive, yes, but the x-coordinate is negative meaning it's relation to x is -x. – TheGreatDuck Mar 8 at 17:48

protected by ᴡᴏʀᴅs Mar 8 at 14:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.