Evaluate the integral $\int_{-1}^{1}\left\vert\, x^{3} - x\,\right\vert\,{\rm d}x$ I'm trying to solve:
$$\int_{-1}^{1}\left\vert\, x^{3} - x\,\right\vert\,{\rm d}x$$
I tried to solve this integral as follows:
solving $x^{3} - x = 0$ which implies $x = 0$ , $x = -1$ or $x = 1$. The problem is at which point will I break the integral ?. Since all of these points lie inside the interval of integration.
The answer is $1/2$. Any help will be appreciated.
 A: To solve this, notice that absolute value yields both a positive and a negative result.
Notice, when $x = -1, 1$, $f(x) = 0$
When $0 <x < 1$, $f(x) < 0$
And when $-1 <x < 0$, $f(x) > 0$
Therefore, we can say that, by spliting the integrals.
$$\int_{-1}^1|x^3-x|dx=\int_{-1}^0(x^3 - x)dx+\int_0^1(x-x^3)dx$$
Solving, we get:
$$\left[\frac{x^4}{4} - \frac{x^2}{2}\right]_{-1}^0 = \frac{1}{2} - \frac{1}{4} = \frac{1}{4}$$
And 
$$\left[\frac{x^2}{2} - \frac{x^4}{4}\right]_{0}^1 = \frac{1}{2} - \frac{1}{4} = \frac{1}{4}$$
So,
$$\frac{1}{4} + \frac{1}{4} = \frac{1}{2}$$
A: We have for $x\in [-1,1]$:
$$x^3-x\ge0\iff x(x-1)(x+1)\ge0\iff -1\le x\le0$$
so
$$\int_{-1}^1|x^3-x|dx=\int_{-1}^0(x^3-x)dx-\int_0^1(x^3-x)dx$$
Can you take it from here?
A: Hint:
$$\int_{-1}^1 \vert x^3-x\vert dx = \int_{0}^1 \vert x^3-x\vert dx + \int_{-1}^0 \vert x^3-x\vert dx$$
If $0 < x < 1$ then $x^3-x < 0$. So:
$$\int_{0}^1 \vert x^3-x\vert dx = -\int_{0}^1  x^3-x\ dx$$
If $-1 < x < 0$ then $x^3-x > 0$. So:
$$\int_{-1}^0 \vert x^3-x\vert dx = \int_{-1}^0  x^3-x\ dx$$
Can you solve it now?
A: Try breaking it into separate problems: you solved $x^3 - x = 0$ at $-1,0,1$, so we have that $$\int_{-1}^1 |x^3 - x| \ dx = \int_{-1}^0 |x^3 - x| \ dx + \int_{0}^1 |x^3 + x | \ dx$$
However, by breaking it up in this way, we can see that when $-1 \leq x \leq 0$, we have $x^3 - x < 0$.  Similarly, $x^3 - x \leq 0$ when $0 \leq x \leq 1$, so the entire equation becomes 
$$\int_{-1}^0 -(x^3 - x) \ dx + \int_{0}^1 -(x^3 + x ) \ dx$$
Have you got it from here? Does that make sense?
