# Are bounded level curves of a continuous function $f(x,y)$ closed?

Let's say I consider all the points $(x,y)$ such that $f(x,y) = c$ for some $c$, given $f$ continuous, and let's assume the set of this points is bounded. Now consider any of the connected components of this set. I get the impression that the only way for a connected component not to be a closed curve (closed in the sense of curves, not in the sense of sets) is for the values $f(x,y)$ to be local extrema. Is this right? If not, can anyone come up with an example of a continuous function that has a bounded non closed level curve, which is not comprised of local extrema? If yes, does the answer extend to higher dimensions? (e.g., closed surfaces for a continuous function $f(x,y,z)$)

• What, precisely, are "local extrema" and "curves" to you in the context of this question? Any closed set in the plane can be cut out by $f(x,y)=c$ for some continuous $f$, so if the set in question is a closed disk or looks like the letter "X" or the digit "8" it's hard to know what you want to be true. Commented Nov 7, 2017 at 23:50
• By local extrema I mean local maxima or local minima. A curve is a continuous line. A closed curve is a curve such that, if you parametrize it by means of a continuous vector valued function $r(t)$, the start and the end of the curve will be the same. If it looks like the digit 8, it's closed. If it looks like an X it's not, but can you find an example for that? Remember, it must be bounded, and the points forming the X must not be local extrema. Commented Nov 8, 2017 at 7:13
• The level sets of continuous functions $f:\>{\mathbb R}^2\to{\mathbb R}$ need not be curves. By Uryson's lemma they can be quite arbitrary closed sets. You have to impose stronger conditions on the considered $f$s. Commented Nov 9, 2017 at 18:57

If $f$ is a continuous function, the set $$\Pi_c=\{(x,y): f(x,y)=c\} = f^{-1}(c)$$ is closed as the inverse image of a closed set (a point of the real line) through a continuous function. Of course it is not always a closed curve: the set

$$\left\{(x,y): \frac{1}{(x-2)^2+y^2+1}+\frac{1}{(x+2)^2+y^2+1}=\frac{2}{3}\right\}$$ is given by the union of two disjoint almost-circles, for instance:

$\hspace1in$

• Thanks Jack, but I asked about each individual connected component of the level set. In your example, each of the almost-circles is closed. Commented Nov 8, 2017 at 7:15

In the comments you ask if a letter $X$ could be one of these connected components. Yes, it can. Define $X= [-1,1]\times \{0\} \cup \{0\}\times [-1,1].$ For $x\in \mathbb R^2,$ define

$$f(x) = \begin{cases} d(x,X)\sin (1/d(x,X)) & x\notin X \\0 & x\in X.\end{cases}$$

Here $d$ is the usual euclidean distance function. Then $f$ is continuous on $\mathbb R^2.$ The level set $f = 0$ is the disjoint union of the curves $\{d(x,X) = 1/(n\pi)\}, n = 1,2,\dots,$ together with $X.$ Thus $X$ is a connected component of $f = 0.$

Note that $f<0$ in $\{1/(2\pi)< d(x,X)<1/\pi \},$ $f>0$ in $\{1/(3\pi)< d(x,X)<1/(2\pi \},$ etc. It follows that in any neighborhood of a point of $X,$ $f$ will take on both positive and negative values. Since $f=0$ on $X,$ no point of $X$ is a local extremum of $f.$

• @kimchilover I'm not sure why you think the relative complement needs to be closed. For example, take the set $X=\{0\}\cup \{1/n:n=1,2,\dots\}$ in the reals. Then $\{0\}$ is a connected component of $X$ but $X\setminus \{0\}$ is not closed in $X.$
– zhw.
Commented Nov 10, 2017 at 17:33

Complete rewrite.

Note that for any topologically closed set $S$ in the plane there is a continuous function $g$ such that $S$ is the zero set of $S$. One example of such a function is $g(x,y)=\operatorname{dist}((x,y),S)$. Here is an example of a set $S$ of a sort you have probably not considered, built up out of the Cantor set $K$, as described in (say) the wikipedia article, together with a more interesting function $f$.

Recall the Cantor set $K$ is a topologically closed subset of $[0,1]$ obtained by removing the union of certain disjoint open intervals. In particular, $K=[0,1]\setminus \bigcup_{n\ge1}C_n$ where $C_n$ is the disjoint union of $2^{n-1}$ particular open intervals of length $3^{-n}$ each, the precise specification of which is spelled out in the wikipedia article and in textbooks. The $C_n$ themselves are disjoint. Define a function $h$ of a real variable by $$h(x) = \begin{cases}0&\text{ if } x\in K\\ \operatorname{dist}(x,K)&\text{ if } x\notin[0,1]\\ (-1)^n\operatorname{dist}(x,K)&\text{ if } x\in C_n.\end{cases}.$$ This function is continuous, has no local maxima or minima on $K$, and has $K$ as its set of zeros. (It is a bit like $x\mapsto x\sin(1/x)$ which does not have a local maximum or minimum at $x=0$. Each point in $K$ is very near points in $C_n$ for $n$ sufficiently large for both even and odd $n$, for which $h$ takes on positive and negative values.)

Let $S=(K\times[0,1])\cup([0,1]\times K)\subset\mathbb R^2$, and note that $S$ is the zero set of the continuous function $f(x,y)=h(x)h(y)\operatorname{dist}((x,y),[0,1]\times[0,1])$. $S$ is topologically connected, topologically closed, bounded, and no point in $S$ is a local maximum or minimum of $f$. I do not know if $S$ is a curve according to your lights, but is does not look at all like the ones in highschool geometry books, or in Jack's answer.

• I am sorry, but I don't think I know enough about fractals to understand your answer completely. I always picture simple structures (something like the one provided in the answer by Jack D'Aurizio). But if I follow you correctly, at least in the case of the 1-skeleton, the level set $f=0$ would be comprised of three circles. I.e., three closed curves. Commented Nov 8, 2017 at 20:29
• I have completely rewritten my answer. It describes a weird level set. Commented Nov 9, 2017 at 0:39
• Thanks a lot! I chose zhw.'s answer because it was simpler than yours, but the core idea is similar, and your counterexample works just as well. Commented Nov 10, 2017 at 7:35
• Thank you! I kicked myself at not coming up with something as simple as zwh's, and then fretted because of a tiny detail I don't get. As to my answer: I am not sure if my $S$ is a curve (in the sense of the continuous image of an interval), so I'm not sure it's exactly a counterexample to what you were asking. Commented Nov 10, 2017 at 11:59

If $f:\mathbb{R}^2 \to \mathbb{R}$ is smooth and proper, you are indeed correct (also with regards to the extension to higher dimensions. The proper is there only to guarantee that it is "closed" and doesn't "go away to infinity"). This is due to the regular value theorem (in the link, it is called "Submersion theorem").

Particularly, in the case of $f:\mathbb{R}^2 \to \mathbb{R}$, your interpretation as "closed curves" is quite accurate due to the classification of $1$-manifolds without boundary: all connected components must be diffeomorphic to circles.

Now, with less technicality (but, of course, less precise statement):

If $f$ is sufficiently well-behaved and the level curve is bounded (recalling that we are under the condition that $f$ does not assume a local extrema for any point in its level curve), then it will be a disjoint union of closed curves.

If you require only continuity, the result is false (as exposed by @kimchi lover's answer).

• Uh, if the definition of a proper map is "preimages of compact sets are compact," then doesn't continuity and/or smoothness already imply this? Commented Oct 11, 2018 at 16:04