Properties of a continuous map $f : \mathbb{R}^2\rightarrow \mathbb{R}$ with only finitely many zeroes

Let $f : \mathbb{R}^2\rightarrow \mathbb{R}$ be a continuous map such that $f(x)=0$ only for finitely many values of $x$. Which of the following is true?

  • Either $f(x)\leq 0$ for all $x$ or $f(x)\geq 0$ for all $x$.
  • the map $f$ is onto.
  • the map $f$ is one one.
  • None of the above.

What I have done so far is :

  • I would take polynomial in two variables.. This need not be like $f(x)\geq 0$ for all $x$ or $f(x)\geq 0$ for all $x$.So,first option is eliminated.
  • The map is not one one assuming that $f$ has more than one zero. So, third option is wrong.

I could not think of an example in which it is not onto..

Only examples i am getting in my mind are polynomials and they are onto..

So, I am having trouble with surjectiveness of the function.

Please help me to clear this.

Thank you..


  • Either $f(x)\leq 0$ for all $x$ or $f(x)\geq 0$ for all $x$.

This one is the most interesting. It can happen that $f$ does not change sign under these conditions: take $u^2+v^2$ for example (if you write $x=(u,v)$). It is positive and has finitely many (one single) zeros. You can have any given number of zeros with $\prod_{i=1}^n \left((u-u_i)^2+(v-v_i)^2\right)$. Notice none of these polynomials ever changes sign.


Now, interestingly, if a continuous function $f$ of $\Bbb R^2 \to \Bbb R$ has finitely many zeros, then it can never change sign.

Assume the contrary, then there are two points x and y such that $f(x)>0$ and $f(y)<0$. Since it has only finitely many zeros, it must be positive for infinitely many points, or negative for infinitely many points, or both. Assume the former, without loss of generality because otherwise you could take $-f$. So, $f$ is positive for infinitely many points (and maybe also negative for infinitely many others, but we don't care).

Draw a ray from $y$, in any direction $d$. If it "hits" a positive value of $f$, that is $f(y+\lambda_d d)>0$ for some $\lambda_d>0$, then there is a zero of $f$ lying between $y_d=y+\lambda_d d$, and $y$, by continuity of $f$, and especially by continuity of the restriction, $\lambda \to f(y+\lambda d)$.

Now, two cases may happen:

  • for infinitely many directions, you can find such a $y_d$, thus there are infinitely many zeros of $f$ (they are all different, since they are on different rays), contradiction.

  • you can find only finitely many such directions. Thus, for infinitely many directions, you find only negative or null values along the ray. Now, draw a circle centered at $y$, with radius larger than $|x-y|$, so that your point $x$ is inside the circle. For infinitely many points $t_i$ on this circle, $f(t_i) \leq 0$. But $f$ has finitely many zeros, thus indeed, for infinitely many points $x_i$ on this circle, $f(x_i) < 0$ (with strict inequality). But then, trace rays between $x_i$ and $x$, and you will find again infinitely many zeros of $f$, hence again a contradiction.

And you are done.

The proof looks rather convoluted to me, maybe there is some obvious argument I didn't see.

By the way, it's trivial to generalize to $\Bbb R^n$ for $n>1$: just pick the restriction of $f$ to a plane where it would take on both positive and negative values.


I'll try to add a bit of intuition. Sadly, I don't have a scanner to show pictures...

It is easy to find a polynomial that has any given number $n$ of zeros, as shown above. But these examples are either always negative or always positive, so you can't get any conclusion from it. Remember, you are in $\Bbb R^2 \to \Bbb R$, thus polynomials don't have necessarily finitely many zeros! And actually, you often get a curve of zeros, and it's a usual way to define curves, for example the unit circle, defined as zeros of $(u,v) \to u^2+v^2-1$.

Now, assume $f$ takes on both positive and negative values. Then $f^{-1}(]-\infty,0[)$ and $f^{-1}(]0, +\infty[)$ are both open sets. My idea was that if both are nonempty, the boundary can't be finite.

Now, the easiest way to find a zero of a continuous function is if it is a function of one variable, and you know it has a positive and a negative value: you just have to use the good old bisection algorithm.

Thus, drawing rays (or half-lines) enables you to look only at functions of one variable. The only thing that remains to do is finding enough zeros, that is enough directions, to lend to a contradiction.


Even if the two other points in the question have easy counterexamples, it's interesting to see if they can happen at all.

  • the map $f$ is onto.

That is, surjective.

Not necessarily. Take $(u,v) \to \frac{1}{1+u^2+v^2}$, which has finitely many (none) zeros, and is bounded.

But, as seen in the answer to the first case, $f$ can't change sign, thus it is always $\leq 0$ or always $\geq 0$, thus certainly never onto $\Bbb R$.

  • the map $f$ is one one.

Not if there is more than one zero, of course, and we saw examples above.

But, could it happen at all? No, there is a proof here: Is there a continuous bijection from $\mathbb{R}$ to $\mathbb{R}^2$. You can also conclude using the fact that if $f$ is continuous and bijective, it has one zero, hence it does no change sign, contradiction because then it can't be bijective.