# Checking the differentiability of the following function

Check the differentiability of the following function $$f(x)=(x+1)|x^2-1|$$ at points $x=1$ and $x=-1$.

My approach

I have written the function in the following form:

$$f(x)=\begin{cases} x^3-x+x^2-1 & \text{ if } x\leq-1,x\geq1 \\ x-x^3+1-x^2 & \text{ if } -1<x<1 \end{cases}$$

Now, taking derivative:

$$f'(x)=\begin{cases} 3x^2-1+2x & \text{ if } x\leq-1,x\geq1 \\ 1-3x^2-2x & \text{ if } -1<x<1 \end{cases}$$

Clearly, the above derivative is continuous at $x=-1$ and discontinuous at $x=1$, hence function will be differentiable at $x=-1$ and $x=1$.

Did I do everything correctly? I am not sure about this and answer has not been provided in the answer manual.

• Looks good to me. Feb 1, 2018 at 9:26
• There is one minor flaw. After differentiating piecewise, you can only be sure that $f'(x)=3x^2-1+2x$ for $x<-1,x>1$, not $x\le-1,x\ge1$, because you don't know yet whether the derivative is defined at $x=\pm1$.
– user856
Feb 1, 2018 at 9:36
• Your argument doesn't work in general. Check it against: $$f(x) = \begin{cases}0 &, x = 0 \\ x^2\sin(x^{-2}) &, x \neq 0 \end{cases}$$ Note $f$ is differentiable at $0$
– wlad
Feb 1, 2018 at 18:18
• I wanted to clarify the previous comment. A function can be differentiable throughout an interval, and yet its derivative can actually be discontinuous. So your claim that $f'\text{ is discontinuous at$x=+1$} \implies f'\text{ doesn't exist at$x=+1$}$ is a fallacy.
– wlad
Feb 1, 2018 at 18:59
• Jose Carlos Santos points out that the combination of these two facts: 1) the one-sided limits of $f'$ exist at $+1$; 2) their values are different; implies that the function is not differentiable at $+1$. I only know how to prove this using Darboux's theorem. If you don't know this theorem, only use the argument by Fred/Peter Szilas.
– wlad
Feb 1, 2018 at 19:04

## 4 Answers

Yes you are correct. You can also see it on the graph

The function ist not differentiable at $x=1$:

$\lim_{x\to 1+}\frac{f(x)-f(1)}{x-1}=4$

and

$\lim_{x\to 1-}\frac{f(x)-f(1)}{x-1}=-4$.

Not differentiable at $x= 1:$

$f(x)=(x+1)|(x+1)(x-1)| = (x+1)^2 |x-1|$

for $x>0.$

Consider : $\dfrac{f(x)-f(1)}{x-1} =$

$\dfrac{(x+1)^2|x-1| }{x-1}.$

$\lim_{x \rightarrow 1^-} \dfrac{(x+1)^2(1-x)}{x-1}=-4.$ $\lim_{x \rightarrow 1^+} \dfrac{(x+1)^2(x-1)}{x-1}= 4.$

Not differentiable at $x=1.$

This is not correct. From the equality$$f(x)=\begin{cases} x^3-x+x^2-1 & \text{ if } x\leqslant-1,x\geqslant1 \\ x-x^3+1-x^2 & \text{ if } -1<x<1 , \end{cases}$$all you can deduce automatically is that$$f'(x)=\begin{cases} 3x^2-1+2x & \text{ if } x<-1,x>1 \\ 1-3x^2-2x & \text{ if } -1<x<1 \end{cases}$$(the inequalities became strict). Since $\lim_{x\to-1^\pm}f'(x)=0$, you can deduce that $f'(-1)=0$. On the other hand, from the fact that $\lim_{x\to1^+}f'(x)\neq\lim_{x\to1^-}f'(x)$ (and both limits exist), you can deduce that $f'(1)$ does not exist.

Another way of proving that it is differentiable at $-1$ is:\begin{align}\lim_{x\to-1}\frac{f(x)-f(-1)}{x+1}&=\lim_{x\to-1}\frac{(x+1)|x^2-1|}{x+1}\\&=\lim_{x\to-1}|x^2-1|\\&=0.\end{align}

• @jkabrg You're right: it's not fine. I've edited my answer. Thank you. Feb 1, 2018 at 18:48