Prove that a continuous function has given property The problem: Suppose $f$ is a continuous function on [0,2] and $f(0) = f(2)$. Prove that there exists $x,y \in [0,2]$ such that $|x-y| = 1$ and $f(x) = f(y)$.

Intuitively this makes sense after thinking about it for some time, but I do not know have to get going.
Consider the function $g(x) = f(x+1)-f(x)$ on $[0,1]$. We have $g(0) = f(1) - f(0) = - (f(2)-f(1)) = -g(1)$, hence $g$ has a zero on $[0,1]$ by the intermediate value theorem.
Function $g(x)=f(x+1)-f(x)$ is continuous on $[0,1]$ and  $g(0)=f(1)-f(0)=f(1)-f(2)=-g(1)$. Then $g(x)=0$ for some $x$ (intermediate value) and $y=x+1$ then $f(y)=f(x)$ and $|y-x|=1$