Proving a continuous function on [0, 1] has a "periodic equalty"?

I've, once again, already worked out this problem, and am just looking for somebody to validate my proof, or point out any errors. Heres the problem:

If $\displaystyle f$ is continuous on $\displaystyle [0, 1]$ and $\displaystyle f(0) = f(1)$, then prove there is some natural number number $\displaystyle n$ such that:

$\displaystyle f(x) = f(x + \frac{1}{n})$

for some $\displaystyle x \in [0, 1]$

Now, heres my attempt at proving it:

Let

$\displaystyle g(x) = f(x) - f(x + \frac{1}{n})$

We know that $\displaystyle g$ is continuous on $\displaystyle [0, 1]$. We also know that there exists a number $\displaystyle z \in [0, 1]$ such that:

$\displaystyle f(z) \geq f(x)$

for all $\displaystyle x \in [0, 1]$

Suppose we let $\displaystyle a = z - \frac{1}{n}$; then we know that we can choose an $\displaystyle n$ large enough to ensure that (since $\displaystyle f(z) \geq f(x)$ for all x):

$\displaystyle f(z - \frac{1}{n}) < f(z + \frac{1}{n} - \frac{1}{n})$

Which means that:

$\displaystyle f(a) < f(a + \frac{1}{n})$

Which implies that:

$\displaystyle g(a) < 0$

Now, we can choose a $\displaystyle b \in [0, 1]$ simmilarly. Suppose $\displaystyle b = z$, then we can ensure (by choosing a large enough or small enough $\displaystyle n$) ensure that:

$\displaystyle f(z + \frac{1}{n}) < f(z)$

Equivilantly...

$\displaystyle f(b + \frac{1}{n}) < f(b)$

Which implies that:

$\displaystyle 0 < g(b)$

Now, by that one theorem (I don't remeber its name), since:

$\displaystyle g(a) < 0 < g(b)$

and $\displaystyle g$ is continuous on $\displaystyle [0, 1]$, and $\displaystyle a, b \in [0, 1]$, then we a garunteed there exists some $\displaystyle x \in [0, 1]$ such that:

$\displaystyle g(x) = 0$

This implies that we are also garunteed an $\displaystyle x \in [0, 1]$ such that:

$\displaystyle f(x) = f(x + \frac{1}{n})$

This completes the proof,.... I hope

I'm not certain if this proof is correct... I'm alittle unsure about weather or not I can garuntee some of the inequalities involving $\displaystyle f(z)$. I'm not even sure if this proof "goes in the right direction" persay. Any guidence, validation, error-pointing-out, and general advice would be much appreciated. Thanks in advance