# Continuity of $f(x)= x\cos 1/x$ when $x\neq 0$, and $0$ otherwise

Is the following function continous on $\mathbb R$?

f(x)=\begin{cases}\begin{align} &x\cos \frac 1x, & x\neq 0 \\ &0, & x=0 \end{align}\end{cases}

I tried to derive it and show the limit from both 0+ and 0- are 0 but I get to infinity plus infinity and such expressions.

This is the derivative: $\frac 1x\sin\left(\dfrac{1}{x}\right)+\cos\left(\dfrac{1}{x}\right)$

Maybe this function isn't continous at all ?

• If you want to check continuity, why do you differentiate? – Daniel Fischer Jan 6 '14 at 21:07
• @DanielFischer Hmm if the function has a derivative at a point its continuous. – Senishoshitsu Jan 6 '14 at 21:08
• Yes, but a lot of functions are continuous but don't have a derivative. Continuity is a much weaker condition. – Daniel Fischer Jan 6 '14 at 21:09
• Ah I see, I made it much more complicated than it should. – Senishoshitsu Jan 6 '14 at 21:10
• Bounding the difference $\lvert f(x) - f(a)\rvert$ is the most direct way. That may sometimes be easier to do one side at a time, but not much. Generally, you use the usual theorems (sums, products, compositions etc. of continuous functions are continuous) when you can, and at special points like $0$ here, you have to estimate the difference. I don't see any useful other way than what user did. – Daniel Fischer Jan 6 '14 at 21:22

It is well know, that $$\left|\cos{a}\right|\leq 1$$ for every $a\in\mathbb{R}$
Because of this it holds $$\left|x\cos{1/x}\right|\leq \left|x\right|\cdot\left|\cos{1/x}\right| \leq\left|x\right|\cdot 1 = \left|x\right|$$ Thus $$\lim_{x\rightarrow 0} f(x) = 0 = f(0)$$
which means that $f$ is continous at $x=0$