# Prove that no function exists such that…

The exercise goes like this:

• Find a continous function $f:\mathbb{R} \rightarrow \mathbb{R}$ such that $\forall c \in \mathbb{R}$ the equation $f(x)=c$ has exactly 3 solutions;
• Prove that no continuous function $f: \mathbb{R} \rightarrow \mathbb{R}$ exists such that the equation $f(x)=c$ has exactly two solutions $\forall c \in \mathbb{R}$;
• For what $n \in \mathbb{N}$ it's true that a continous function $f:\mathbb{R} \rightarrow \mathbb{R}$ such that $\forall c \in \mathbb{R}$ the equation $f(x) = c$ has exactly $n$ solutions exists?

For the first point I built kind of a zigzag function which is easily generalizable to every odd $n$. It seems true to me that for even natural numbers such a function doesn't exist, because in some ways it would have to "jump", but I failed to formalize the argument.

• @Git Gud: Sorry then; as soon as I find the other questions I'll report this one myself – Gennaro Marco Devincenzis Apr 14 '14 at 16:55
• My intent was to inform, not to criticize. I up voted your question. – Git Gud Apr 14 '14 at 16:56
• Didn't take it as a criticism, I was serious. :) – Gennaro Marco Devincenzis Apr 14 '14 at 16:57
• For the odd case here it is. The even case is an older question. – Git Gud Apr 14 '14 at 17:00
• For particular cases of the even case see 1 and 2. Neither of these was the one I saw recently. – Git Gud Apr 14 '14 at 17:02

We assume that $f$ is continuous and that the equation $f (x)=c$ always has at least two solutions, and find a $c$ for which the equation has at least three solutions.

Suppose $f (x_1)=f (x_2)=0$ for $x_1 <x_2$. Since $f$ is continuous, it is bounded on $[x_1, x_2]$, and attains its maximum. Let this maximum be $M$. Assume for now that $M> 0$, and let $m\in [x_1, x_2]$ satisfy $f (m)=M$.

By the intermediate value theorem, there must be $m_1$ and $m_2$ such that $f (m_1)=f (m_2) =M/2$ and satisfying $$x_1 <m_1 <m <m_2 <x_2.$$

Now consider an $n$ such that $f (n)=2M$. We know that $n\notin [x_1, x_2 ]$ so without loss of generality assume that $x_2<n$. Applying the IVT again, there must be a solution to $f (x)=M/2$ in the interval $[x_2, n]$. But that means we have at least three solutions to $f (x) =M/2$.

If $M=0$, you can apply the same argument to $-f$.

• My argument below was more or less the same. Do you think this is generalizable for every even n? The problem I see with the generalization is that we lose the "constant sign in the interval" thingy (now it's late, I'll think about it some more tomorrow). – Gennaro Marco Devincenzis Apr 14 '14 at 21:59
• Generalizing to $2k$. Suppose we have $2k$ solutions $x_1<\dots <x_{2k}$ to $f(x)=0$. On each $(x_j,x_{j+1})$ the function must be either positive or negative. For the positive intervals, work as before, taking the maximum on each interval, but instead of $M/2$, use $M_0/2$ where $M_0$ is the minimum of the maxima of the positive intervals. Let the corresponding term for negative intervals be $N_0$. We end up with $2k-1$ intervals, each with either (at least) two solutions to $f(x)=M_0/2$ or $f(x)=N_0/2$. At least one of these equations must thus have $2k$ solutions in $[x_0,x_{2k}]$. – Unwisdom Apr 14 '14 at 22:27

Point two: Suppose such a function exists. We note that the function has to be surjective and has to have two roots (i.e. points $a_1$ and $a_2$ such that $f(a_1,a_2)=0, a_1<a_2$ without loss of generality). In the interval $]a_1,a_2[$ the function has to have constant sign (suppose it doesn't, since the function is continuous there have to be another root, contradicting what we said earlier). Moreover, since by the Weierstrass theorem the function is limited in $[a_1,a_2]$ the signs before $a_1$ and after $a_2$ have to be opposite, since otherwise the function wouldn't be surjective. Suppose now that the function is $>0$ in the interval $[a_1,a_2]$ (it isn't restrictive since the argument is easily replicable if it isn't). The function can't be constant in the interval, since if it is then there are infinite points for which the function takes the constant value and we have a contradiction. Let's take then any point in the interval which isn't a maximum. We also note that if a point is a maximum it can't be zero, so it has to be in the internal part of the interval. There are, by our hypothesis, at most two points in which the function takes a maximum ($m_1$ and $m_2$, $m_1<m_2$). Let's call the two intervals $[a_1,m_1]$ and $[m_2,a_2]$. Inside the intervals, the function has to take every value between $0$ and $f(m_1)=f(m_2)=M$. So for every point in $[a_1,m_1]$ and $[m_2,a_2]$ there are two roots. But since in the interval $[a_2,+\infty[$ (but it could be in $]-\infty,a_1]$, the argument wouldn't change) the function takes every value between $0$ and $\infty$, thus we have found another root and a contradiction.

Maybe this is generalizable (please report any mistake whatsoever).