$f(x) = |\cos x|$ prove that f is differentiable at these points and not differentiable at all other points. Define $f : \mathbb R → \mathbb R$ by $f(x) = |\cos x|$. Determine the set of points where f is differentiable and calculate the derivative of f on this set. Also prove that $f$ is differentiable at these points and not differentiable at all other points.
My working: 
from the graph of $|\cos x|$, we can see that the $|\cos x|$ is differentiable everywhere except at 
points where $x=(k+\frac{1}{2})\pi$, where $k$ is an integer, but this is intuitive, i'm having difficulty giving a proper proof of $|\cos x|$ being differentiable at these points.
 A: Maybe this will help you. @Poppy has given you the right hint. Consider the two limits
$$
\lim\limits_{h\to 0^+}\dfrac{|\cos{(k\pi+\frac{\pi}{2}+h)}|-0}{h}
$$
and
$$
\lim\limits_{h\to 0^-}\dfrac{|\cos{(k\pi+\frac{\pi}{2}+h)}|-0}{h}
$$
for the function to be differentiable the two limits must be equal. Consider them. Since in the first $h>0$ and in the second $h<0$ you can take the absolute value away (the nominator does not change sign). You will see that the two limits have a different sign (since h in the denominator change the sign) and therefore the function is not differentiable at that point.
Generally speaking when you have a cusp (is the right english term)? Your derivative (the slope of the tangent) will suddenly jump in value, often changing sign.
EDITED: to answer the OP question. When can you take the absolute value away? If the argument of the absolute value is positive (let's consider only real number) then you can take away the absolute value, if the argument is negative then you can take it away but you have to add a minus. Some examples:
$$
|3|=3
$$
$$
|-3|=3
$$
or more generally 
$$
A>0 \Rightarrow |A|=A
$$
$$
A<0 \Rightarrow |A|=-A
$$
Is it clearer now?
EDIT 2: to answer the questions in the comments on why is differentiable in all other points.
Let's consider only the range of angles $[-\pi/2, \pi/2]$ for the moment. In this case the $\cos (x)$ is positive and therefore our definition of derivative can written without the absolute value
$$
\lim_{h\to 0}\frac{cos(x+h)-cos(x)}{h}
$$
this limit does not depend on the fact that $h\to 0^+$ or $h\to 0^-$. It exists and is the well known derivative of the $\cos$ function. 
When you consider the range of angles $[\pi/2, 3\pi/2]$ you can take the absolute value away adding a minus sign (since the $\cos$ is now negative). But then again the limit does not depend if $h$ reaches zero from the right or the left. 
A: $\lim\limits_{h\to0}\dfrac{f(x+h)-f(x)}{h}=\text{in our case}=\lim\limits_{h\to0}\dfrac{|\cos{(k\pi+\frac{\pi}{2}+h)}|-0}{h}$
Can you solve this limit?
