TITLE: Existence of non-constant continuous functions with infinitely many zeros
QUESTION [10 upvotes]: 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.

REPLY [2 votes]: 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$.