Let $f(x) \leq g(x)$ for all $x$ in an open set $D$, and let $a$ be an interior point of $D$ such that $f(a) = g(a)$ and both $f, g$ are differentiable at $a$. Does it follows that $f'(a)=g'(a)$?
Is that right, and if so, why? If not then please give examples.
Proof
I will give a proof for the problem as follows, which totally depends on some most basic facts of calculus. According to the assumptions, $$\frac{f(x)-f(a)}{x-a}\leq \frac{g(x)-g(a)}{x-a},\tag1$$where $x$ belongs to some right neighborhood of $a.$ And$$\frac{f(x)-f(a)}{x-a}\geq \frac{g(x)-g(a)}{x-a},\tag2$$where $x$ belongs to some left neighborhood of $a.$Thus, for $(1)$, let $x \to a+.$ $$\lim_{x \to a+}\frac{f(x)-f(a)}{x-a}\leq \lim_{x \to a+}\frac{g(x)-g(a)}{x-a},\tag 3$$which implies $$f'_+(a) \leq g'_+(a).\tag4$$Likewise, for $(2)$, let $x \to a-.$ $$\lim_{x \to a-}\frac{f(x)-f(a)}{x-a}\geq \lim_{x \to a-}\frac{g(x)-g(a)}{x-a},\tag 5$$which implies $$f'_-(a) \geq g'_-(a).\tag6$$
But by the definition of the differentiability, we have $$f'(a)=f'_+(a)=f'_-(a),~~~~~g'(a)=g'_+(a)=g'_-(a).\tag7$$
Thus, $(4)$ and $(5)$ claim that $$f'(a) \leq g'(a),~~~~~f'(a) \geq g'(a)\tag8$$respectively, which demands $$f'(a)=g'(a).$$