Computing the integral $\int_{-1}^{2} \left( |x| + |1-x| \right) {\rm d} x$ I'm having trouble with one of the exercises, I have to split the integral for the absolute value but I can't manage to algebraic find the boundaries for the integral.
$$\int_{-1}^{2} \left( |x| + |1-x| \right) {\rm d} x$$
Thanks in advance!
 A: There are three regions:
$$\int_{-1}^{2} (|x|+|1-x|) dx=\int_{-1}^{0}-2x+1 \ dx +\int_{0}^{1}1\ dx+\int_{1}^{2}2x-1 \ dx=5.$$
To verify this, take a look at the following figure:

A: $$\int_{-1}^2 dx (|x|+|1-x|) = \int_{-1}^0 dx (-x + 1-x) + \int_0^1 dx (x+1-x) + \int_1^2 dx [x-(1-x)] $$
Go...
A: $|x|=x$ when $x>0$ and $|x|=-x$ when $x<0$.  Similarly, $|1-x|=1-x$ when $1-x>0$ and $|1-x|=x-1$ when $1-x<0$.  We end up with three different cases: $x<0$, $0<x<1$, and $x>1$.  For example, when $x<0$, we have
$$|x|+|1-x|=-x+1-x=1-2x$$
which you should have no problem integrating now that the absolute values are gone.  You should be able to handle the other two cases.
A: The point where $|x|$ 'changes form' (between $x$ and $-x$) is when $x=0$.
The point where $|1-x|$ changes form is when $1-x = 0$
A: You don't need to do the actual integration, just remember that you're summing the area under the curves.  Notice that $$\int_{-1}^{2} (|x|+|1-x|) dx$$ equals $$\int_{-1}^{2} (|x|) dx + \int_{-1}^{2} (|1-x|) dx$$  Then just draw both parts on a graph.  You'll see that each part specifies two triangles: one with an area of 0.5 and the other with an area of 2.  Add that up $(2 + 0.5 + 2 + 0.5)$ to get 5
