[Math] Computing the integral $\int_{-1}^{2} \left( |x| + |1-x| \right) {\rm d} x$

absolute valuecalculusdefinite integralsintegration

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!

Best Answer

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:

![enter image description here

Related Question