$$f=\begin{cases}\cos(x+\pi) &,x>0\\x^2+x-1 &,x\leq 0\end{cases} \tag{1}$$

Problem 1: Where's $f$ continuous?

$f$ is continuous on $\mathbb R\setminus\{0\}$ since it consists of continuous functions there. We check $x=0$.

$$\lim_{x\to 0^{+}}f(x)=\lim_{x\to 0^{+}}\cos(x+\pi)=\cos(\pi)=-1 \tag{2}$$ and $$\lim_{x\to 0^{-}}f(x)=\lim_{x\to 0^{-}} x^2+x-1=-1 \tag{3}$$

so $f$ is continuous on $\mathbb R$.

Problem 2: Where is $f$ differentiable?

The only problem point might be $x=0$. We have $$f'(x)=\begin{cases}-\sin(x+\pi) &, x>0\\ 2x+1 &, x<0\end{cases}\tag{4}$$ so f is diferentiable on $\mathbb R\setminus\{0\}$.

I'd like to use two different approaches here:

Approach 1: Definition

$$\lim_{h\to 0^{+}}\frac{f(0+h)-f(0)}{h}=\lim_{h\to 0^{+}}\frac{\cos(h+\pi)-(-1)}{h}=\lim_{h\to 0^{+}}\frac{-\sin(h+\pi)}{1}=0 \tag{5}$$

$$\lim_{h\to 0^{-}}\frac{f(0+h)-f(0)}{h}=\lim_{h\to 0^{-}}\frac{h^2+h-1-(-1)}{h}=\lim_{h\to 0^{+}}\frac{h^2+1}{1}=1 \tag{6}$$

so we can conclude, that $f$ is not differentiable at $x=0$

Approach 2: Limit

We see

$$\lim_{x\to 0, x>0} f'(0)=0, \quad \lim_{x\to 0, x<0} f'(0)=1 \tag{7}$$

so $f$ is not differentiable at $x=0$

Question: I think I misunderstand approach 2 sind I am not sure how approach 2 shows that $f$ is not differentiable at $x=0$. It'd make sense that $f$ is differentiable if those limits would've been the same but since they aren't, isn't the only statement we can make that $f$ isn't continuous differentiable at $x=0$? Couldn't it be, that $f'$ might be discontinuous at $x=0$ but still differentiable?


Your conclusion is correct, the first approach is the right way to verify if the function is differentiable. Let's see an example of the differences between the two approaches.

Consider the function $f:\mathbb{R} \to \mathbb{R}$ defined as $$ f(x)= \begin{cases} x^2\sin\left(\dfrac1x\right), \ x \neq 0\\ 0, \ x=0. \end{cases} $$

This function is differentiable everywhere. At $x=0$ we just calculate $$ \lim_{h \to 0} \frac{f(h)-f(0)}{h} = \lim_{h \to 0} \frac{h^2\sin(1/h)}{h} = \lim_{h \to 0} h\sin(1/h) = 0. $$

At any other point, we can obtain the derivative by the usual rules of differentiation. Therefore, we have $$ f'(x)= \begin{cases} 2x\sin(1/x)-\cos(1/x), \ x\neq 0\\ 0, \ x=0. \end{cases} $$

Notice that $\lim_{x \to 0}f'(x)$ does not exist, so even though $f$ is differentiable everywhere, the derivative is not continuous at $x=0$.

So, to sum it up, it is possible for a function to be differentiable at a point and for its derivative to be discontinuous at this same point. This shows that the second approach is not the correct one.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.