Let $g:(-a,0) \to \mathbb{R}$ be differentiable and $h:[0,a) \to \mathbb{R}$ be differentiable on $(0,a)$. Suppose further that $\lim_{x \to 0^{-}}g(x) = h(0)$ and $\lim_{0^{+}}h'(x) = \lim_{x \to 0^{-}}g'(x) = L$. Define $$ f(x) = \begin{cases} g(x) \; x < 0 \\ h(x) \; x \geq 0 \end{cases} $$ Prove that $f$ is differentiable at $0$ or find a counterexample that shows that $f$ is not necessarily differentiable at $0$.
I want to prove that $f$ is differentiable at $0$. Here's where I get stuck:
We want that bound $|\frac{f(a) - h(0)}{a} - L|$ by choosing $a$ sufficiently close to zero. We first consider the case when $a > 0$. By triangle inequality we have
$$
\left|\frac{h(a) - h(0)}{a} - L\right| \leq \left|\frac{h(a) - h(0)}{a} - h'(a)\right| + \left|h'(a) - L\right|.
$$
We can easily bound $|h'(a) - L|$ by choosing small enough $\delta$, however I've really struggled to bound $\left|\frac{h(a) - h(0)}{a} - h'(a)\right|$. The case for which $a < 0$ we also run into a similar problem. I've tried to prove this by contradiction as well but that was not panning out either. I think that maybe the $f'(0)$ is guaranteed to exist but not necessarily equal to $L$.
I would love either a full solution or a hint. Thanks!
We may apply L'Hôpital's rule so that \begin{align*} \lim_{x\rightarrow 0^-} \frac{f(x)-f(0)}{x-0} = \lim_{x\rightarrow 0^-} g'(x) =L, \end{align*} and \begin{align*} \lim_{x\rightarrow 0^+} \frac{f(x)-f(0)}{x-0} = \lim_{x\rightarrow 0^-} h'(x) =L. \end{align*} Hence, $f'(0)$ exists and must be equal to $L$.