Find the absolute maximum and minimum of $f(x) = \left|\cos^2(x) - \frac{3}{4}\right|$ on $[0,\pi]$ 
Find the absolute maximum and minimum of $f(x) = \left|\cos^2(x) - \frac{3}{4}\right|$ on $[0,\pi]$

I have learnt that in order to find the absolute maximum, I need to check the value of the function at the: 

*

*sides of $[0,\pi ]$

*in points that the function isn't differentiable.

*in points that satisfy $f'(x)=0$ 
 How do I approach this question? I have no idea how to differentiate it with the absolute value, and how could I find the points that aren't differentiable in $[0,\pi ]$.  any help is appreciated.
 A: Well, I will give you some (big) hints:

*

*Notice that when $x\in\left[0,\frac{\pi}{6}\right]$ we have $\left|\cos^2\left(x\right)-\frac{3}{4}\right|=\cos^2\left(x\right)-\frac{3}{4}$;

*Notice that when $x\in\left[\frac{\pi}{6},\frac{5\pi}{6}\right]$ we have $\left|\cos^2\left(x\right)-\frac{3}{4}\right|=\frac{3}{4}-\cos^2\left(x\right)$;

*Notice that when $x\in\left[\frac{5\pi}{6},\pi\right]$ we have $\left|\cos^2\left(x\right)-\frac{3}{4}\right|=\cos^2\left(x\right)-\frac{3}{4}$;

*Notice that:

$$\cos^2\left(x\right)=\frac{1+\cos\left(2x\right)}{2}\tag1$$


*Notice that:

$$\frac{\text{d}}{\text{d}x}\left(\cos^2\left(x\right)-\frac{3}{4}\right)=\frac{1}{2}\cdot\left\{\frac{\text{d}}{\text{d}x}\left(1\right)+\frac{\text{d}}{\text{d}x}\left(\cos\left(2x\right)\right)\right\}-\frac{3}{4}\cdot\frac{\text{d}}{\text{d}x}\left(1\right)=$$
$$\frac{1}{2}\cdot\left\{0+\frac{\text{d}}{\text{d}x}\left(\cos\left(2x\right)\right)\right\}-\frac{3}{4}\cdot0=-\frac{1}{2}\cdot\sin\left(2x\right)\cdot\frac{\text{d}}{\text{d}x}\left(2x\right)=$$
$$-\frac{1}{2}\cdot\sin\left(2x\right)\cdot2\cdot\frac{\text{d}}{\text{d}x}\left(x\right)=-\frac{1}{2}\cdot\sin\left(2x\right)\cdot2\cdot1=-\sin\left(2x\right)\tag2$$


*Notice that, likewise $(2)$ only with a flipped sign:

$$\frac{\text{d}}{\text{d}x}\left(\frac{3}{4}-\cos^2\left(x\right)\right)=\sin\left(2x\right)\tag3$$
