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... 

 A: $$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$$
A: 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$$
A: $\newcommand{\+}{^{\dagger}}%
 \newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
 \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
 \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
 \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\down}{\downarrow}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\half}{{1 \over 2}}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\ol}[1]{\overline{#1}}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
\begin{align}
&\color{#00f}{\large\int_{-1}^{1}\verts{3x^{2} - x}\,\dd x}=
\left. x\verts{3x^{2} - x}\vphantom{\huge A}\right\vert_{-1}^{1}
-\int_{-1}^{1}x\sgn\pars{3x^{2} - x}\pars{6x - 1}\,\dd x
\\[3mm]&=6-\int_{x = -1}^{x = 1}\sgn\pars{3x^{2} - x}\,
\dd\pars{2x^{3} - {x^{2} \over 2}}
\\[3mm]&=6 - \left.\sgn\pars{3x^{2} - x}\pars{2x^{3} - {x^{2} \over 2}}
\right\vert_{-1}^{1} 
+ \int_{-1}^{1}\pars{2x^{3} - {x^{2} \over 2}}2\delta\pars{3x^{2} - x}\pars{6x - 1}
\,\dd x
\\[3mm]&=2 + \int_{-1}^{1}\pars{4x^{3} - x^{2}}\pars{6x - 1}
\bracks{\delta\pars{x} + \delta\pars{x - {1 \over 3}}}\,\dd x
=2 + \left.\pars{4x^{3} - x^{2}}\pars{6x - 1}\right\vert_{x\ =\ 1/3}
\\[3mm]&=2 + {1 \over 27} = \color{#00f}{\large{55 \over 27}}
\end{align}
