Existence of non-constant continuous functions with infinitely many zeros [duplicate]

Possible Duplicate:
A nontrivial everywhere continuous function with uncountably many roots?

Does there exist a continuous non-constant real-valued function on $[a,b]$ that has infinitely many zeros? If one does exist, please give me an example.

marked as duplicate by J. M. is a poor mathematician, yunone, Martin Sleziak, Srivatsan, Rudy the ReindeerDec 21 '11 at 7:31

• Just pick any sub-interval where the function is zero and extend it to the rest... – Aryabhata Jun 30 '11 at 19:52
• Let me try to spruce up the question a bit: can one characterize the subsets of $[0,1]$ which are zero sets of infinitely differentiable functions? – Pete L. Clark Jun 30 '11 at 19:58
• $f(x)=x+|x|$ on $[−1,1]$ ? I suppose we should restrict the problem a little more to be more interesting (not constant on any subinterval, perhaps, as assumes Arturo) – leonbloy Jun 30 '11 at 19:59
• How about a $C^{oo}$ function with isolated zeros? – gary Jun 30 '11 at 20:04
• @Pete, @Mark: Every closed set is the zero set of a smooth function: For each open component of the complement there is a smooth function which is bigger than zero exactly on the component and goes to zero as we approach the boundaries. Now we may add such functions on all the components together as they have disjoint supports. – Sam Jun 30 '11 at 20:23

[!!! There is an error in the following argument !!! ]

Since this answer has been accepted, I can no longer delete it, however. The comments below may be useful for anyone interested.

In fact every closed subset of $$\mathbb R$$ is the zero set of a smooth function:

First, suppose we are given an open interval $$I = (a,b) \subset \mathbb R$$. We will construct a smooth function $$f: \mathbb R\to [0,1]$$ satisfying $$f(x)>0 \iff x \in I$$.

Then, if we are given a closed set $$K \subset \mathbb R$$, the complement $$U = \mathbb R\setminus K$$ can be written as the disjoint union of countably many open intervals $$I_n$$ for $$n\in \mathbb N$$, i.e.

$$U = \bigcup_{n=1}^\infty I_n, \quad \text{with } \; I_n \cap I_m = \varnothing \; \text{ for m\ne n}$$

Assuming the first part, we can find smooth functions $$f_n: \mathbb R\to [0,1]$$ such that $$f_n(x) > 0$$ if and only if $$x \in I_n$$. Now define

$$g(x) := \sum_{n=1}^\infty f_n(x)$$

Then $$g$$ is well-defined and smooth, because for any point $$x\in \mathbb R$$ there is a neighborhood $$V$$ such that only finitely many $$f_n$$ are nonzero on $$V$$ (in fact we can choose $$V$$ sufficiently small such that it intersects two intervals $$I_m$$ and $$I_n$$ at most).

Let us prove the first assertion: So, we are given $$I=(a,b)\subset \mathbb R$$ and want to construct $$f: \mathbb R\to [0,1]$$ such that $$f(x) >0\iff x \in I$$.

First, let

$$h(x) = \begin{cases} e^{-1/x} & x>0 \\ 0 & x\le 0\end{cases}$$

I think, it is a standard exercise in Analysis to prove that $$h$$ is smooth, so I won't bother doing this here. Now define

$$f(x) = h(x-a)h(b-x)$$

This function is smooth and maps into $$[0,1]$$ ($$h\le 1$$). Furthermore $$f(x) \ne 0 \iff x-a >0 \text{ and } b-x>0 \iff a < x < b$$

This concludes our observation.

• This is usually called Whitney's theorem. It is a special case of a vastly more general and even more surprising result, see the original reference and the Wikipedia entry. – t.b. Jun 30 '11 at 21:17
• @Theo: does it follow from Whitney's theorem that every closed subset of a smooth manifold is the zero set of a smooth function? (If not, how do you prove that?) – Pete L. Clark Jun 30 '11 at 23:41
• @Pete: I don't see a cheap way of getting it directly (partitions of unity seem to fail, or I miss a clever trick), but you can use Whitney's embedding theorem and embed your manifold smoothly and properly into some $\mathbb{R}^{N}$. Then apply Whitney's extension theorem to the closed subset you want as a zero set (but this smells like overkill). – t.b. Jun 30 '11 at 23:53
• @Pete: Now that this question was bumped, I see that I indeed missed a (not so clever) trick: Cover your manifold $M$ with charts $V_i$ in such a way that there are open $U_i \subset V_i$ already covering $M$ (we may choose the cover $V_i$ locally finite) and choose a partition of unity $\rho_i$ subordinate to $V_i$ such that $\rho_i(u) \gt 0$ for $u \in U_i$. If $A$ is our closed set we can choose a smooth $f_i : V_i \to \mathbb{R}$ such that $f_i(x)^2 = 0$ iff $x \in A \cap V_i$ by Whitney. Now put $f = \sum \rho_i \cdot f_{i}^2$ and clearly $f(x) = 0$ iff $x \in A$. – t.b. Sep 13 '11 at 3:06
• In this other post mathoverflow.net/questions/24034/…, the height of the bump functions were carefully set to make the derivative converge uniformly to its pointwise limits. I can't see any flaw in your argument though. Why didn't you need to bother rescaling your h? – Rodrigo Oct 12 '13 at 0:57

You can take $$f(x) = \left\{\begin{array}{ll} (x-a)\sin\left(\frac{1}{x-a}\right)&\text{if }x\neq a\\ 0 &\text{if }x=a. \end{array}\right.$$

You can even make it differentiable on $[a,b]$ by replacing the $(x-a)$ factor with $(x-a)^2$. This function is not constant on any subinterval.

• Ah, this function is a counterexample to so many fake theorems in analysis. – Joel Cohen Jun 30 '11 at 20:48
• The function $f(x) = \left\{\begin{array}{ll} (x-a)\sin\left(\frac{1}{x-a}\right)&\text{if }x\neq a\\ 0 &\text{if }x=a. \end{array}\right.$ also is non-constant in $\mathbb{C}$ – Zophikel Sep 9 '17 at 14:53
• Is it possible to get uncountably-many zeros in a compact subset, other than with $d(x,S)$ , for S a closed subspace and d the Hausdorff distance :=$Inf \{d(x,s): s \in S \}$? – gary Nov 28 '17 at 23:09
• @gary: Trivially so; take $[-1,2]$, then take a function which is zero on $[0,1]$ and is not the Hausdorff distance and nonzero on $[-1,0)$ and $(1,2]$. E.g., $f(x) = 0$ if $0\leq x\leq 1$, $f(x) = e^x-1$ on $[-1,0)$, and $f(x) = e^x-e$ on $(1,2]$. That's continuous. – Arturo Magidin Nov 28 '17 at 23:17
• @gary: Your first sentence does not imply the second. Presumably you meant "between any two zeroes there is a point where the function is not zero" (otherwise, the function I gave you does satisfy the condition you first list: between any two zeroes there is a third point where the function is also zero). Again, the answer is provided by the top answer to this question, since ANY closed set is the zero set of a smooth function. Take, say, the Cantor set as your closed set (which is bounded, hence compact), and take the corresponding function. The Cantor set is uncountable. – Arturo Magidin Nov 28 '17 at 23:45

It is well known that, with probability $1$, the zero set of Brownian motion is an uncountable closed set with no isolated points.

• In fact, it has positive Hausdorff dimension. $1/2$, if I recall correctly. – Nate Eldredge Jul 1 '11 at 3:35
• @Shai Covo: Can this happen in a compact subset of the Real line? – gary Nov 28 '17 at 23:45

And if you want a $C^\infty$-function, how about $f(x)=0$, if $x\le(a+b)/2$ and $f(x)=e^{-1/(a+b-2x)^2}$, whenever $x>(a+b)/2$.

Such a functions does exists not only for interval $[a,b]$, but for inifinite general metric spaces.

Let $(X,\rho)$ be some infinite metric space. For each $A\subset X$ we define distance from $x$ to $A$ by equality $\rho(x,A)=\inf\{\rho(x,y):y\in A\}$. Since for all $x_1,x_2\in X$ we have $|\rho(x_1,A)-\rho(x_2,A)|\leq\rho(x_1, x_2)$, we see that $\rho(\cdot,A):X\to\mathbb{R}_{+}$ is uniformly continuous. Obviously $x\in\overline{A}$ iff $\rho(x,\overline{A})=0$.

Let $Y$ be some closed infinite subset of $X$. Since Y is closed then the zero set of $\rho(\cdot,Y)$ is $Y$. Thus we constructed a uniformly continuous function with zero set equal to infinite set $Y$.

• I'll edit this typo – Norbert Dec 21 '11 at 5:11
• Oh, I just misread. Sorry, I guess the overline in $\overline A$ was blended into the line above in my careless reading. The correction was really unnecessary, and the original statement was apt, because $\rho(x,\overline A)=\rho(x,A)$. – Jonas Meyer Dec 21 '11 at 5:12
• I thought this correction will emphasize overline. Of course this is unnecessary correction – Norbert Dec 21 '11 at 5:30