# Continuity in a piece wise function

So I have this piece wise function here which is:

$$f(x)=% \begin{cases} x + \cos(\frac{1}{x}) &{ x \neq 0 } \\ 0 &x=0. \end{cases}$$

and I have to:

a) Show that $f(x)$ is continuous everywhere

b) Find $f'(x)$

c) Justify if $f'(x)$ is continuous on its domain.

A function is said to be continuous if the limit from both sides equal equal each other. The only problem is that it doesn't. From the left, the limit oscillates back and forth when I use the squeeze theorem and from the right, the limit is $0$ so I don't think I am doing part a right. The two sided limit does not exist so the function isn't continuous

For part b, a hint in the question says that I will use the limit definition of the derivative to find $f'(x)$ . I don't see why though because I am not calculating the derivative at a point so there should be no reason to use it. Even if the question did ask me to find the derivative at $x=0$, I would get that the limit is non-existent because if I used the definition, then the limit from both ends end up going to opposite infinite so I don't think the limit would exist for that either.

For part c, I don't think derivative is continuous because $f'(x)$ doesn't exist so it's impossible to say it's continuous.

Can someone tell me what I am doing wrong or if I am even approaching this properly? Part a tells me that the function should be continuous but it's not according to my reasoning. Similarly, my explanations for part b and c seems to be off as well...

• Are you certain you've transcribed the problem correctly? As you've written it, you're absolutely correct that the function is discontinuous and hence not differentiable at $0$ (though slight quibble: the limit doesn't exist from either direction). But with only a slight modification it wouldn't be; for example, if that were $x\cos(\frac{1}{x})$ instead of $1 + \cos(\frac{1}{x})$. – Reese Mar 5 '17 at 4:34
• Sure I'm sure. Here is the original, unchanged question. EDIT: I did make a typo... Still, it doesn't change anything for my work. imgur.com/a/9qUOc – Future Math person Mar 5 '17 at 4:36
• It looks like that was intended to be $x\cos(\frac{1}{x})$, not $x + \cos(\frac{1}{x})$. As it's written, the problem isn't correct - I suspect the author made a typo. – Reese Mar 5 '17 at 4:37
• Yes. That's what I figured too. Thanks. – Future Math person Mar 5 '17 at 4:39
• Even had it been $xcos(\frac{1}{x})$, I don't think that $f'(x)$ would be continuous, as the problem suggests. – imranfat Mar 5 '17 at 4:43