For to be differentiable, it must be continuous, so we need to have
By its definition, . The one-sided limits are
so we require .
In order for to be differentiable at , we also need to have exist, which requires that also be continuous at . First, compute the derivatives of all pieces of :
is continuous at if
The one-side limits are
so we need to have , and moreover will be differentiable if we set .