TITLE: Pair of functions with same values and same derivatives at distinct points
QUESTION [16 upvotes]: Let $f,g:[0,1]\to \mathbb{R}$ be two functions of class $C^1$ such that $f'(x)>0$ and $g'(x)>0$ for all $x\in [0,1]$. Assume that
$$
f(0) = g(0) \qquad \text{and} \qquad f(1) = g(1).
$$
Show that there exist $x,y\in[0,1]$ such that
$$
f(x) = g(y) \qquad \text{and} \qquad f'(x) = g'(y).
$$
I made the following attempts (non of them worked): First, define a function $h:[0,1]\times [0,1]\to \mathbb{R}$ given by
$$
h(x,y) = [f(x)-g(y)]^2 + [f'(x)-g'(y)]^2
$$
and try to show that $h(x,y) = 0$ for some $(x,y)$. Then I defined $k:[0,1]\times [0,1] \to \mathbb{R}$ by
$$
k(x,y) = \frac{1}{2}[f(x)-f(y)]^2
$$
and tried to show that at some point $(x,y)$ the divergence of $k$ is zero, because in this case we have that
$$
0 = \frac{\partial k}{\partial x}(x,y) + \frac{\partial k}{\partial y}(x,y) = (f(x)-g(y))f'(x)-(f(x)-f(y))g'(y) = (f(x)-f(y))(f'(x)-g'(y))
$$
but it didn't work either. May be I'm not following the right way to solve this exercise.

REPLY [20 votes]: Set $a = f(0) = g(0)$ and $b = f(1) = g(1)$. $f$ and $g$ are strictly increasing from $[0, 1]$ to $[a, b]$ and therefore invertible. If we define the function
$$
 h: [a, b]\to \Bbb R, \, h(t) = f^{-1}(t) - g^{-1}(t)
$$
then $h(a) = h(b) = 0$ and Rolle's theorem shows that for some $c \in (a, b)$
$$
 0 = h'(c) = \frac{1}{f'(f^{-1}(c))} - \frac{1}{g'(g^{-1}(c))} \\
\implies f'(f^{-1}(c)) = g'(g^{-1}(c)) \, .
$$
We can now set
$$
  x = f^{-1}(c) \, , \, y = g^{-1}(c) \, .
$$
$x$ and $y$ are both in the open interval $(0, 1)$ and have the desired properties
$$
 f(x) = g(y) \, , \, f'(x) = g'(y) \, .
$$
Illustration: The graphs of $f$ and $g$ are green. $c$ is the argument on the $y$-axis where the inverse functions have the same slope. $x$ and $y$ are the pre-images of $c$ under $f$ and $g$.

(Created with GeoGebra.)
Remarks:

If $f$ and $g$ are not identical functions then $h$ is not identically zero and we can choose $c\in (a, b)$ as a point where $h$ attains its nonzero minimum or maximum, so that $x - y = h(c) \ne 0$.
This shows that (unless $f=g$) a pair $x, y$ of distinct points in $(0, 1)$ with those properties exists.

It suffices to require that the functions are continuous on $[0, 1]$, and differentiable on $(0, 1)$ with positive derivative. The continuity of the derivative, or differentiability at the endpoints is not needed. (This was noticed by Ari Brodsky in a comment.)