I have proved the following problem, can you help me check if there is any loopholes in my proof?
Let I be an open interval in R, let $c \in I$, and let $f, g\colon I\to \mathbb{R}$ be functions. Suppose that $f(c) = g(c)$, and that $f(x) \leq g(x)$ for all $x \in I$. Prove that if f and g are differentiable at c, then f'(c) = g'(c).
So the following is my proof:
Let $x \in I$,
if $x \lt c$, then $\lim\limits_{x\rightarrow c-}\frac{f(x) - f(c)}{x-c}$ = $\lim\limits_{x\rightarrow c-}\frac{f(c) - f(x)}{c-x} \geq \lim\limits_{x\rightarrow c-}\frac{g(c) - g(x)}{c-x} = \lim\limits_{x\rightarrow c-}\frac{g(x) - g(c)}{x-c}$
if $x \gt c$, then $\lim\limits_{x\rightarrow c+}\frac{f(x) - f(c)}{x-c} \leq \lim\limits_{x\rightarrow c+}\frac{g(x) - g(c)}{x-c}$
Since $f$ and $g$ are differentiable at $c$, we know that \lim\limits_{x\rightarrow c-}\frac{f(x) - f(c)}{x-c} = \lim\limits_{x\rightarrow c+}\frac{f(x) - f(c)}{x-c}=f'(c) and \lim\limits_{x\rightarrow c-}\frac{g(x) - g(c)}{x-c} = \lim\limits_{x\rightarrow c+}\frac{g(x) - g(c)}{x-c} = g'(c)
Thus $\lim\limits_{x\rightarrow c-}\frac{f(x) - f(c)}{x-c} = \lim\limits_{x\rightarrow c+}\frac{f(x) - f(c)}{x-c} = \lim\limits_{x\rightarrow c-}\frac{g(x) - g(c)}{x-c} = \lim\limits_{x\rightarrow c+}\frac{g(x) - g(c)}{x-c}$
Therefore f'(c) = g'(c).
I can't find any problem in my proof, but for some reason I'm not feeling comfortable with it. However, if it's totally correct, just tell me :) Thanks!!