# Finding functions max and min (abs value)

I have the function $$g(x)=|x^2-x-2|$$ which is defined on $$-\frac{3}{2}\leq x\leq \frac{3}{2}$$

I am struggeling with that g(x) has absolute values wrapped around. I taught that I just draw the graph and flip the negative values upwards but that seems not to work.

I started by finding the roots, $x_1=2, x_2=-1$ and then I taught that because this is a second order function, the max (or min) should be either in one of the limit points or at $\frac{1}{2}$ because it is just between the roots.

I cant get it right, I think that the abs value confuses me, how do I handle them?

The polynome is negative between the roots, so on [-1;3/2] your function is $g_1(x)=x^2-x-2$ and it is then positive outside so on [-3/2;-1] your function is $g_2(x)=-x^2+x+2$.
You will certainly have a minimum at $x=-1$, since you have found that $g(-1)=0$ and $g(x)\geq 0$ due to the absolute value. The rest of your analysis is correct; just check the boundaries of the interval and the vertex of the parabola, $x=1/2$.