Does one need a proof to show that the function is continuous

calculuscontinuityreal-analysis

Let $$ f(x) = \begin{cases} x \cos\left(\frac{1}{x}\right) & \text{if } x \neq 0 \\ 0 & \text{if } x=0\end{cases}$$ Is $f$ continuous? Is $f$ differentiable?

$f'(x) = \cos(\frac{1}{x})+\frac{\sin(1/x)}{x}, x\neq 0\\ f'(0) = \lim \limits_{h \to 0} \frac{f(h)-f(0)}{h} \\ \lim \limits_{h \to 0} \frac{f(h)}{h} \Leftarrow \lim \limits_{h \to 0} \frac{h\cos(1/h)}{h} \\ \lim \limits_{h \to 0} \cos(\frac{1}{h}) \\ h \neq0 \\ -1 \le\cos(\frac{1}{h})\le 1 \qquad \qquad (\text{ Squeeze Theorem}) \\ \lim \limits_{h \to 0} 1 =1\\ \lim \limits_{h \to 0} -1 =-1 \\ \lim \limits_{h \to 0} \cos\frac{1}{h} = \text{DNE} \\ \text{f is not differentiable on } \mathbb{R. } \\ f'(x) = \begin{cases} \cos\frac{1}{x}+\frac{\sin1/x}{x}, & \text{if } x \neq 0 \\ 0 & \text{if } x=0\end{cases} \\ \text{ Hence f is not differentiable on } \mathbb{R}.$

$\qquad \text{My question is since this function is not differentiable.}\\\text{ How can I show whether this function is continuous or not continuous?} \\ \text{I know one way to show continuity is by showing at a point that it is } \\ \text{ continuous. For Example } \\ \text{ Showing that the left hand limit is the same as the right hand limit at zero.} \\ \text{Since at x = 0 things are changing. Is that the way to solve this problem or } \\ \text{ is a proof required to show whether this is continous or not?}$

Best Answer

Well, yes, you need to prove that it is continuous. Outside $0$, that's easy: your function is obtained from continuous function through arithmetic operations and composition. At $0$, use the fact that$$(\forall x\in\mathbb R):-\lvert x\rvert\leqslant x\cos\left(\frac1x\right)\leqslant\lvert x\rvert$$and therefore, by the squeeze theorem,$$\lim_{x\to0}f(x)=0=f(0).$$