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