[Math] Examine the continuity and differentiability of $f(x)=| \cos x|$

continuityderivativesreal-analysis

Examine the continuity and differentiability of $f(x)=| \cos x|$

I got the answer to be everywhere continuous and not differentiable
at $ x=(2n+1) \frac{\pi}{2}, n \in \mathbb Z $

(since modulus function is not differntiable at $\cos x = 0$ i.e. if $f(x)=|x-a|$ then it is not differentiable at $x=a$)

But I want to prove it mathematically i.e. proving $$\lim_{x\to c^+}f(x)=\lim_{x\to c^-}f(x)=f(c)$$
and
$$\lim_{x\to c^+}\frac{f(x)-f(c)}{x-c}=\lim_{x\to c^-}\frac{f(x)-f(c)}{x-c}$$

Thankyou

Best Answer

Continuity follows because the compision of continuous functions is continuous. Differentiability outside $\pi\mathbb Z+\frac\pi2$ follows because $|\cdot|$ is differentiable away from $0$ and again composition of differentaible functions is differentiable. That $f$ is not differentiable at $(n+\frac12)\pi$, however, needs to be checked explicitly (for example $x\mapsto|\cos^2 x|$ would be differentiable in spite of the modulus).

For example, at $c=\frac\pi2$, you have $|\cos x|=\cos x$ for $0<x\le c$ and $|\cos x|=-\cos x$ for $c\le x<c+\frac\pi2$. Then $$\begin{align}\lim_{x\to c^+}\frac{f(x)-f(c)}{x-c)}&=\lim_{x\to c^+}\frac{-\cos x-0}{x-c}=\sin c=1\\ \lim_{x\to c^-}\frac{f(x)-f(c)}{x-c)}&=\lim_{x\to c^-}\frac{\cos x-0}{x-c}=-\sin c=-1\end{align}$$