# Differentiability and continuity of a piecewise function.

Consider

$$f(x) = \left\{ \begin{array}{l l} 0 & \quad \text{if x=0}\\ \frac{1-\cos 2x}{x} & \quad \text{otherwise} \end{array} \right.$$ Which of the following is true?

1.$f$ is continuous

2.$f$ is differentiable

3.$f$ is continuously differentiable

• What are your thoughts? – Vladimir Jun 10 '14 at 6:57
• it is continuous and also differentiable and i think it is also continuously differentiable.Is it correct? – Nannes Jun 10 '14 at 7:06
• Yes. How could you prove that? – Vladimir Jun 10 '14 at 7:08
• \begin{align}1-\cos{2x}&=2\sin^2{x} \\ \lim\limits_{x\rightarrow 0}{\dfrac{1-\cos{2x}}{x}}&=\lim\limits_{x\rightarrow 0}{\dfrac{\sin^2{x}}{x}}=0\end{align} – hrkrshnn Jun 10 '14 at 7:09
• Continuity is obvious by just using the deffinition and i calculate derivative of f at 0 which is f'(0)=2 using the deffinition.So it should be continuously differentiable. – Nannes Jun 10 '14 at 7:10

## 2 Answers

1. Yes, and easy to check.
2. Yes, also easy to check.
3. Yes also. To see this part:

$f'(0) = \displaystyle \lim_{x \to 0} \dfrac{f(x) - f(0)}{x} = \displaystyle \lim_{x \to 0} \dfrac{1-cos(2x)}{x^2} = \displaystyle \lim_{x \to 0} 2\dfrac{sin^2x}{x^2} = 2$,

and $f'(x) = 4\cdot \dfrac{sin(2x)}{2x} - \dfrac{1-cos(2x)}{x^2}$ for $x \neq 0$.

Using L'hopital rule we can check that $f'(0) = 2 = \displaystyle \lim_{x \to 0} f'(x)$. Thus $f'(x)$ is continuous at $x = 0$, and hence continuously differentiable.

Now you need to check the continuity at $x=0$. Given $\epsilon \gt 0$, if there exists a $\delta \gt 0$ such that $|x| \lt \delta$ $$\implies |\frac{1-cos2x}{x}|=|\frac{2sin^2x}{x}| \le|\frac{2x^2}{x}|=|2x| \lt 2\delta=\epsilon$$ S0 for $$\delta = \frac{\epsilon}{2}$$ , we have $|f(x)-f(0)| \lt \epsilon$, and hence as per our definiton $f$ is continuos.

For differentiabilty $$\lim_{h\to 0}\frac{1-cos2h}{h^2}=\lim_{h\to 0}\frac{2sin^2h}{h^2}=2$$. Hence $F$ is differentiable at $x=0$.

From here you can see the (iii) I hope