Find the global extreme values of a the following function $f(x) = x|x^2-6|- \frac{3}{2} x^2 +2$ in [-2,4] $f(x) = x|x^2-6|- \frac{3}{2} x^2 +2$
With this function I know that I need to differentiate it in order to find the local maxima and minima points. However it always confuses me a bit on what I should do when there's a modulus/absolute value within the equation. Once I've found the derivative I'm pretty certain on what to do.
Anyways what I'm thinking right now is to have three cases. Firstly when $x^2$ is greater than 6, secondly when $x^2$ is less than 6 and finally when it's equal to 6. Is this the right approach? I'm also going to test $f(-2)$ & $f(4)$ since they're the limits.
 A: hint
Observe that
$$-\sqrt{6}<-2<\sqrt{6}<4$$
and
$$-\sqrt{6}<x\le \sqrt{6}\implies$$
$$ |x^2-6|=-x^2+6$$
$$\sqrt{6}\le x\le 4\implies |x^2-6|=x^2-6$$
Thus , at $ [\sqrt{6},4]$,
$$f'(x)=3x^2-6-3=3(x^2-3)>0$$
and at $ [-2,\sqrt{6}] $,
$$f'(x)=6-3x^2-3=3(1-x^2)$$
You have to check $ f(\pm 1) $.
A: 
Anyways what I'm thinking right now is to have three cases. Firstly when $x^2$ is greater than 6, secondly when $x^2$ is less than 6 and finally when it's equal to 6. Is this the right approach? I'm also going to test $f(-2)$ & $f(4)$ since they're the limits. Also I don't really need the case when $x^2$ is less than 6 do I? Since it would be outside of the range

First of all, you can collapse $x^2 > 6$ with $x^2 = 6.$
Second of all you do need the case of $x^2 < 6$ because (for example) $1$ is in the domain.
I would split the function into two separate functions, based on whether
$x^2 < 6$ or $x^2 \geq 6$.  Then you can differentiate each one, as long as you are careful to note that the separate functions each have a restricted domain.
A: Hint 1: If $f: \mathbb{R}\to \mathbb{R}$ such that $$f(x)=x|x^{2}-6|-\frac{3}{2}x^{2}+1$$
So,
\begin{eqnarray*}
f'(x)&=&\frac{d}{dx}\left(x|x^{2}-6|-\frac{3}{2}x^{2}+1 \right)\\
&=&0-3x-\frac{d}{dx}\left(x|x^{2}-6\right)\\
&=&-3x-|x^{2}-6|-x\frac{d}{dx}\left(|x^{2}-6|\right)
\end{eqnarray*}
Hint 2: If we need to find $\displaystyle \frac{d}{dx}\left(|x^{2}-6|\right)$
we can use the chain rule $\displaystyle \frac{d}{dx}(|x^{2}-6|)=\frac{d|t|}{dt}\frac{dt}{dx}$ where $t=x^{2}-6$ and$\displaystyle \frac{d}{dt}(|t|)=\frac{t}{|t|}$.
Using that, you can find $$\frac{d}{dx}\left(|x^{2}-6|\right)=\frac{x^{2}-6}{|x^{2}-6|}\frac{d}{dx}(x^{2}-6)$$
