Determining values where a function is not differentiable 
Given
$$g(x) = 
\begin{cases}
-1-2x & \text{if }x< -1,\\
x^2 & \text{if }-1\leq x\leq1,\\
x & \text{if }x>1,
\end{cases}
$$
determine at which values $g(x)$ is differentiable. 

The approach I have taken with this question is to determine the values at which it is not differentiable, which will tell me all other values will be. I know that the function will not be differentiable where the limit at a given value does not exist. If I differentiate this function I get:
$$
g'(x) = 
\begin{cases}
-2 & \text{if }x< -1,\\
2x & \text{if }-1\leq x\leq1,\\
0 & \text{if }x>1.
\end{cases}
$$
I am a little bit lost as to how to proceed with this question - if I can show that the left hand and right hand limits disagree, then I can determine where the function is not differentiable, and therefore where it is differentiable. Am I heading in the right direction here? 
 A: First, note that $g'(x)=1$ for $x>1$.
On the interior of each of the intervals $(-\infty,-1)$, $[-1,1]$, and $(1,\infty)$ $g$ is differentiable since each component function is. The only question is what happens at the endpoints of these intervals.
At $x=-1$, the value of both component functions is $1$ and the derivative of both component functions is $2$. This means we get
$$
\lim_{h\to0^-}\frac{g(-1+h)-g(-1)}{h}=-2\tag{1}
$$
Because $x^2=-1-2x$ at $x=-1$, we can use $g(x)=-1-2x$ for the computation of $(1)$.
Furthermore, we get
$$
\lim_{h\to0^+}\frac{g(-1+h)-g(-1)}{h}=-2\tag{2}
$$
using $g(x)=x^2$ for the computation of $(2)$.
Since the derivatives computed in $(1)$ and $(2)$ are the same, we get that $g(x)$ is differentiable at $x=-1$.
At $x=1$, the value of both component functions is $1$, however, the derivative of $x^2$ is $2$ and the derivative of $x$ is $1$. This means that
$$
\lim_{h\to0^-}\frac{g(1+h)-g(1)}{h}=2\tag{3}
$$
using $g(x)=x^2$ for the computation of $(3)$.
However, we get
$$
\lim_{h\to0^+}\frac{g(1+h)-g(1)}{h}=1\tag{4}
$$
Because $x=x^2$ at $x=1$, we can use $g(x)=x$ for the computation of $(4)$.
Since the derivatives computed in $(3)$ and $(4)$ are different, $\lim\limits_{h\to0}\frac{g(1+h)-g(1)}{h}$ does not exist, and therefore $g(x)$ is not differentiable at $x=1$.
