# Integrating an absolute function

I know that you can define the absolute value of a as: |a| = a when a>0 and |a| = -a when a<0

At first sight I thought this function would always evaluate to a positive value; however, after analysing it correctly, there is a small interval of values for which the result will be negative, so the question is, how do I define the proper interval for which I have to integrate negative values...? It's not clear as in some other functions I've worked with, in which by just looking at them I can tell in which value the things will start to change...

I think I have to divide this integral in 3 sub integrals...

-

$$3x^2-x=3x\left(x-\frac13\right)\ge 0\iff x\le 0\;\;or\;\;x\ge\frac13\implies$$

$$\int\limits_{-1}^1|3x^2-x|dx=\int\limits_{-1}^0(3x^2-x)dx+\int_0^{1/3}(-3x^2+x)dx+\int\limits_{1/3}^1(3x^2-x)dx\;\;\ldots$$

-

Recall the formula for absolute value. It is $$|x|=\begin{cases}x, &x\ge 0\\ -x, & x\lt 0\\ \end{cases}$$ Therefore, you will need to find when $3x^2-x\lt 0$ and $3x^2-x\ge 0$. In your case, it will give you $3x^2-x\lt 0$ when $x\in (0,\frac13)$ and $3x^2-x\ge 0$ when $x\in [-1,0]$ and $x\in [\frac13, 1].$ Therefore your integral becomes $$\int_{-1}^1 |3x^2-x|dx = \int_{-1}^0 (3x^2-x)dx -\int_0^{\frac13} (3x^2-x)dx + \int_{\frac13}^1 (3x^2-x)dx$$

-


-