# Function Continuity Real Numbers

I need to find a continuous function which takes every real value exactly 2n+1 times, for any $n \in \mathbb{N}$

-

Hint:

$$\hspace{11cm} /\/\/\/\.../$$ $$\hspace{5.5cm} /\/\/\/\.../$$ $$/\/\/\/\.../$$

-
Is this a step function ? –  Carpediem Oct 9 '12 at 13:48
@user43758: No, within each interval it is a sawtooth (though it could be sine waves or other shapes). A step function takes each value uncountably many times. This is an excellent hint, it leaves some work to do. –  Ross Millikan Oct 9 '12 at 13:52
you can make it smooth if you want. Basically, you construct a W shape or a sin-type function which takes all the values in $(-1,1)$ exactly 2n+1 times, and then move it to left-right and up-down....Be carefull: the local max-mins are attained less times than 2n+1, so you need to allign the maxes with the mins of the next copy.... –  N. S. Oct 9 '12 at 13:52
This is great! +1 –  mixedmath Oct 9 '12 at 18:46

I will show you one way to do the case $n=1$. You can generalize it to all $n$.

Start with a function $\phi:[0,1]\to[0,1]$ whose graph is

$\phi$ takes every $y\in(0,1)$ exactly three times, but $0$ and $1$ only two. Now define $f$ on $[k,k+1]$ as $\phi(x-k)+k$, $k\in\mathbb{Z}$.

-
well it will be sin(x-k)+k no ? –  Carpediem Oct 9 '12 at 13:57
Actually $\phi(x)=\sin^2(3\,\pi\,x/2)$ on $[0,1]$, but you can take any function with a similar graph. –  Julián Aguirre Oct 9 '12 at 14:04
So for every $i \in {{0,n-1}}$, we define on [i,i+1] the function $\phi (x)= sin^2(\frac{3 \pi x}{2}-i)+i$ –  Carpediem Oct 9 '12 at 14:07
Yes. But what is important is not the particular formula, but the idea of the construction. –  Julián Aguirre Oct 9 '12 at 14:15
So how do I proceed in the construction of the formula ? –  Carpediem Oct 9 '12 at 14:17

Same idea:

$f(x) = \sin(x)+ax$, where $a \approx 0.21723$ is the solution of $\sqrt{1-a^2} - a\pi-a\arccos(a) = 0$, so that one local maximum value equals a subsequent local minimum value.

-