TITLE: integration of $\int_0^6 |x^2 - 6x +8| dx$
QUESTION [7 upvotes]: $$\int_0^6 |x^2 - 6x +8| dx =$$
I know the answer to this problem is $\frac{44}3$. But, how do you get that? How does the solution change based on the absolute value? Without the absolute value I got an answer of 12 - I found the anti-derivative:$\frac{x^3}3-3x^2+8x$. I then solved it which got me 12. However, this is not the answer to the above problem. What should I be doing?

REPLY [2 votes]: Let $F(x):=\frac13 x^3-3x^2+8x$ so, because $F^\prime$ is negative on $(2,\,4)$ but positive on $(0,\,2)\cup(4,\,6)$, your integral is$$F(2)-F(0)-(F(4)-F(2))+F(6)-F(4)=F(0)+F(6)+2(F(2)-F(4))\\=0+12+2\left(\frac{20}{3}-\frac{16}{3}\right)=\frac{44}{3}.$$