Question:
The integral $\int_{0}^{2}|| x-1|-x| d x$ is equal to
Solution:
$\int_{0}^{2}|| x-1|-x| d x=\int_{0}^{1}|1-x-x| d x+\int_{1}^{2}|| x-1-x \mid d x$
$=\int_{0}^{1}(1-2 x) d x+\int_{1 / 2}^{1}(2 x-1) d x+\int_{1}^{2} d x$
$=\left[x-x^{2}\right]_{0}^{\frac{1}{2}}+\left[x^{2}-x\right]_{\frac{1}{2}}^{1}+[x]_{1}^{2}$
$=\frac{1}{2}-\frac{1}{4}+(1-1)-\left(\frac{1}{4}-\frac{1}{2}\right)+2-1=\frac{1}{4}+\frac{1}{4}+1=\frac{3}{2}$