TITLE: Application of the Intermediate Value theorem.
QUESTION [5 upvotes]: Suppose $f$ is continuous on $[0,2]$ and that $f(0) = f(2)$. Then $\exists$ $x,$ $y \in [0,2]$ such that $|y - x| = 1$ and that $f(x) = f(y)$.

Let $g(x) = f(x+1) - f(x)$ on $[0,1]$. Then $g$ is continuous on $[0,1]$, and hence $g$ enjoys the intermediate value property! Now notice $$g(0) = f(1) - f(0)$$ $$g(1) = f(2) - f(1)$$
Therefore $$ g(0)g(1) = -(f(0) - f(1))^2 < 0$$
since $f(0) = f(2)$. Therefore, there exists a point $x$ in $[0,1]$ such that $g(x) = 0$ by the intermediate value theorem. Now, if we pick $y = x + 1$, i think the problem is solved.
I would like to ask you guys for feedback. Is this solution correct? Is there a better way to solve this problem?

REPLY [2 votes]: Very good! 
It is enough to write $g(1)=-g(0)$..
And, as Hagen commented, you only forgot to mention the case when already $f(0)=f(1)$, but then it is readily done.