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.