Proving the distance between two points is 1 on a continuous function this is a tough question.
We suppose $f$ is continuous on $[0,2]$ and $f(0) = f(2)$. We want to prove $\exists$ $x, y \in [0,2]$ such that $ \lvert y-x \rvert = 1 $ and $ f(x) = f(y)$.


*

*My attempt 


Just from the fact $f(0) =f(2)$ I imagined an upside down parabola with roots at $0$ and $2$. We define a function $g(x) = f(x+1) - f(x)$ on $[0,1]$. We also recognize that $y = x \pm 1$ because the distance between the two points is 1.
I have no idea how to proceed from here. 
Any help would be appreciated!
 A: Without loss of generality, let $y = x + 1$. Define $g(x) = f(x+1) - f(x), 0 \leq x \leq 1$. This function is continuous on $[0, 1]$ since $f(x)$ is continuous. Observe that
$$
g(1) = f(2) - f(1)
$$
and
$$
g(0) = f(1) - f(0) = f(1) - f(2)
$$
If $f(2) = f(1)$, we've find a $(x, y)$ pair satisfying the problem with $x = 1, y = 2$. Otherwise, since one of $g(1)$ and $g(0)$ is greater than $0$ and another is less than $0$, there must exists a $x' \in [0, 1]$ such that $g(x')=0$ since $g(x)$ is continuous. Then $f(x') = f(x' + 1)$.
A: Let $f(0)=f(2)=h$,and define $G(x) =f(x)-h$,so $G(0)=G(2)=0$.   Let $y=c,c$ constant,be a horizontal linear function. suppose that $G(k)=m$ be the max (or the min) of $G(x)$ in $[0,2]$. Let,G(x)=y(x)=c; It's obvious that this equation have two roots in $[0,2]$ for all $0<=c<m$ .Lets call this roots $R_1(c)$,$R_2(c)$,defined as functions of c. let $H(c)= |R_1(c)-R_2(c)|$, so $H(c)$ is continuous (why?) in $[0,m]$ and H(0)=2 and H(m)=0, so exist n in $[0,m]$ such $H(n)=1$, and this prove the result.
