Question on finding derivative for a piecewise function with absolute value Let $f(x)=\begin{cases}\frac{1}{2}x^2 ~~~~~&\text{if } |x|\leq c \\ c|x| - \frac{1}{2}c^2 ~~~~~&\text{if } |x|> c \end{cases}$, where $c>0$ is just a constant value in $\mathbb{R}$
Then I find out $f'(x) = \begin{cases}x ~~~~~&\text{if } |x| < c \\ \frac{cx}{|x|} ~~~~~&\text{if } |x| > c \end{cases}$.
Since, $c>0$ is a constant in $\mathbb{R}$.
Then, $\lim_{h\rightarrow c^{-}}\frac{f(h)-f(c)}{h}=\lim_{h\rightarrow c^{-}}\frac{\frac{1}{2}h^2-\frac{1}{2}c^2}{h} = \frac{0}{c} = 0$
Also, $\lim_{h\rightarrow c^{+}}\frac{f(h)-f(c)}{h}=\lim_{h\rightarrow c^{+}}\frac{c|h|-\frac{1}{2}c^2-\frac{1}{2}c^2}{h} = \frac{0}{c} = 0$
So, in this case is $f'(x)=\begin{cases}x ~~~~~&\text{if } |x| < c \\ \frac{cx}{|x|} ~~~~~&\text{if } |x| > c \\ 0 ~~~~~&\text{if } |x| = c \end{cases}$ the derivative of $f(x)$ above ?

It does not seem quite right to me.  The denominator should be $h-c$ in each calculation.
For $x = c > 0$, the left derivative is,
\begin{align}
\lim_{h \to c^-} \frac{f(h)-f(c)}{h-c} = c
\end{align}
and the right derivative,
\begin{align}
\lim_{h \to c^+} \frac{f(h)-f(c)}{h-c} = c
\end{align}
so that the derivative at $c$ exists but is $c$, not $0$. Similar arguments apply when $x = -c$.
