Function which takes on every value in $[0,1]$ an infinite number of times.

113 Views Asked by At

Give an example of a continuous real-valued function $f$ form $[0,1]$ to $[0,1]$ which takes on every value in $[0,1]$ an infinite number of times.


My example goes like this: Take $f(x)=\lim_{n \to \infty} g(x)$ where. $$g(x)=\left\{\begin{array}{l} n x, \frac{k}{n} \leq x \leq \frac{k+1}{n} ; k \text { is even } \\ -n x, \frac{k}{n} \leq x \leq \frac{k+1}{n} ; k \text { is odd } \end{array}\right.$$ Does this work? I'm unable to verify.