# Showing differentiability of piece-wise function

Problem:

Let $f: \mathbb R \to \mathbb R$ be

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

Is f differentiable?

Soltuion:

Continous: $\lim_{x\to 0, x>0}f(x)=-1=\lim_{x\to 0, x < 0}f(x)=-1$

The derivative on $\mathbb R\setminus \{0\}$ is

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

We have (1) $\lim_{x\to 0, x > 0} f'(x)=0$ and $\lim_{x\to 0, x < 0}f(x) = 1$, so $f$ isn't differentiable at $0$, so f is not differentiable on $\mathbb R$

Question: How does the argument (1) show that f isn't continouse? As far as I am concerned, it only shows that $f'$ isn't continouse at 0 but it doesn't say anything about it's existence.

So how does (1) work for arguing that $f$ isn't differentiable?

• What is "argument (1)"? There's nothing labeled as "(1)" in your post... – zipirovich Aug 9 '18 at 14:06
• It is labeled "We have (1) ..." – xotix Aug 9 '18 at 18:43

$f$ is not differentiable at 0 as you have shown that the left and the right limit for $f'(x)$ is not equal at $x=0$ $$\underset{x\to {0}^{-}}{\mathrm{lim}}f'\left(x\right)\neq \underset{x\to {0}^{+}}{\mathrm{lim}}f'\left(x\right)$$

but $f$ is continuous at 0 because the left limit and right limit is equal for $f(x)$ at $x=0$

$$\underset{x\to {0}^{-}}{\mathrm{lim}}f\left(x\right)=\underset{x\to {0}^{+}}{\mathrm{lim}}f\left(x\right)$$

• Is it obvious that if the limits of $f'$ from the left and right are not equal, then the function is not differentiable? It's possible, for example, for the limits of $f'$ from the left and right not to exist, but $f$ is still differentiable. – Callus Aug 9 '18 at 14:59

If $f$ was differentiable at $0$, the left derivative would be equal to the right derivative (by unicity of the limit). You proved that those numbers aren’t equal. Hence $f$ can’t be differentiable at $0$.

The given function is $f: \mathbb R \to \mathbb R$

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

A function is differentiable if: (i) it is continuous on that interval (ii)it has no sharp corner or cusp and (iii)the derivative exists(finite) on that interval i.e. has a tangent line with a finite slope.

Now,(i) for $x \gt 0,f(x)=\cos(x+\pi)=-\cos x$ and for $x \le 0,f(x)=x^2+x-1$.Thus,$f(x \approx 0) \approx -1$.Thus $f$ is continuous.

(ii)for $x \le 0$ the function $f(x-0)=x^2+x-1$

for $x \gt 0$ the function is $f(x+0)=-\cos x \approx -1+\dfrac{x^2}{2}$

the two parabolas $f(x-0)$ & $f(x+0)$ are not the same(they have different forms),so the function $f$ isn't smooth at $0$

(iii)the derivative $f'$ doesn't exist on any (small) interval containing the origin.

Hence $f$ is not differentiable at $0$.