Show that for each $0<r<1$ there is such $x,y \in [0,1]$ s.t. $|x-y|=r$ and $f(x)=f(y)$.

let $f:[0,1] \rightarrow \mathbb R$ be continuous and non-negative.its given that $f(0)=f(1)=0$.

show that for each $0<r<1$ there is such $x,y \in [0,1]$ s.t. $|x-y|=r$ and $f(x)=f(y)$.

SOLUTION ATTEMPT: I'm trying to use the Intermediate value theorem in order to show what they want. which means, defining a new function $G(x)$ such that by inserting the values $G(1)$ and $G(0)$ I get two values that their product is less than zero, and that means there is such $0<c<1$ in which $G(c)=0$. and from here somehow get that $f(x)=f(y)$, but I'm stuck here and don't know what is $G(x)$. any kind of help would be appreciated.

• Try $G(x)=f(x)-f(x+r)$ and $G(0)$, $G(1-r)$.
– user302982
Jan 7 '16 at 10:37
• ^^^ What is $G(1)$? Oh ok I get it it is defined only on $[0,1-r]$. Jan 7 '16 at 10:38
• $G: [0, 1-r]\to \mathbb{R}$
– user302982
Jan 7 '16 at 10:39

Look at $G\colon [0,1-r]\to \mathbb{R}, x\mapsto f(x)-f(x+r)$. Then $G$ is continuous and $G(0)=-f(r)\leq 0, G(1-r)=f(1-r)\geq 0$. Thus by Intermediate value theorem we have a $x_0\in [0,1-r]$ with $G(x_0)=f(x_0)-f(x_0+r)=0$. We see $f(x_0)=f(x_0+r)$.