The reason I ask this is because $$\int_{x=a}^{x=b}\left|x\right|\mathrm{d}x$$ gives exactly the same result as $$\int_{x=a}^{x=b}x\mathrm{d}x=\frac{b^2}{2}-\frac{a^2}{2}=\int_{x=a}^{x=b}\left|x\right|\mathrm{d}x$$ when $0 \leq a \leq b$
But for a non trivial case could someone please show the steps of integration of $$\int_{x=a}^{x=b}\left|x\right|\mathrm{d}x$$ for $-7\le a\le 8$ and $0\le b\le 12$.
Thank you.
Notice, as per given intervals, we have
$$=\int_{a}^{0}(-x)dx+\int_{0}^{b}(x)dx$$$$=-\left[\frac{x^2}{2}\right]_{a}^{0}+\left[\frac{x^2}{2}\right]_{0}^{b}$$ $$=\frac{a^2}{2}+\frac{b^2}{2}=\frac{a^2+b^2}{2}$$ 2. $a\geq 0$, $b\geq 0$ $$\int_{x=a}^{x=b}|x|dx=\int_{a}^{b}xdx=\left[\frac{x^2}{2}\right]_{0}^{b}$$$$=\frac{b^2}{2}-\frac{a^2}{2}=\frac{b^2-a^2}{2}$$