Question:
$\int_{2}^{8}|x-5| d x$
Solution:
Let $I=\int_{2}^{8}|x-5| d x$
It can be seen that $(x-5) \leq 0$ on $[2,5]$ and $(x-5) \geq 0$ on $[5,8]$.
$I=\int_{2}^{5}-(x-5) d x+\int_{2}^{8}(x-5) d x$ $\left(\int_{a}^{b} f(x)=\int_{a}^{c} f(x)+\int_{c}^{b} f(x)\right)$
$=-\left[\frac{x^{2}}{2}-5 x\right]_{2}^{5}+\left[\frac{x^{2}}{2}-5 x\right]_{5}^{8}$
$=-\left[\frac{25}{2}-25-2+10\right]+\left[32-40-\frac{25}{2}+25\right]$
$=9$