Let $f:[0,1] \rightarrow \mathbb{R}$ be a continuous function and $f(0)=f(1)$. Show that for all $n \in \mathbb{N}$ there is $x, 0 \leq x < x+\frac{1}{n} \leq 1,$ such that $f(x)=f(x+\frac{1}{n})$.
I define $g(t)=f(t+\frac{1}{n})-f(t)$ but I couldn't find appropriate $a,b$ such that $g(a)g(b)<0$.