## Zeros of a function

Does there exist a continuous function $$f:\mathbb{R}\rightarrow\mathbb{R}$$ such that f is nowhere constant and $$\{x:f(x)=0\}$$ is uncountable?
 PhysOrg.com science news on PhysOrg.com >> Ants and carnivorous plants conspire for mutualistic feeding>> Forecast for Titan: Wild weather could be ahead>> Researchers stitch defects into the world's thinnest semiconductor
 Sure there is.
 Can you give an example?

## Zeros of a function

Well....the irrationals aren't countable...
 Recognitions: Homework Help Science Advisor That is a misleading answer - any continuous function that is zero on the irrationals is 0 everywhere. [0,1] is uncountable, and surely anyone can think of a function that is 1) continuous 2) non-constant 3) 0 on [0,1]
 He said that f is nowhere constant.
 Yes, I did say f is nowhere constant. If f=0 on the subset of irrationals of some interval, then continuity implies that f=0 on that interval. Intuitively, what I want is a everywhere continuous nowhere differentiable function that is "straight" enough so that a horizontal line intersects the values uncountably many times. I don't think such a function exists, but I can't prove it either way. The "continuous but nowhere differentiable" requirement might not be necessary, or even relevant, but it's a good place to start looking.
 Take the function f(x) = 0 on [0,1]. Now replace f on the interval [1/3,2/3] with a triangle wave. Now replace f on the intervals [1/9,2/9] and [7/9,8/9] with a similar triangle wave. Repeat this process for every interval on which f is zero, and we have a continuous function that vanishes on the Cantor set (which is uncountable), and is nowhere constant. Replacing the triangle wave with a suitable $C^{\infty}$ function yields an infinitely differentiable function that vanishes uncountably many times but is not constant. If you want it to be continuous but nowhere differentiable, replace each triangle wave with such a function instead.
 Whoops. Missed the continuity assumption.

 Quote by Moo Of Doom Take the function f(x) = 0 on [0,1]. Now replace f on the interval [1/3,2/3] with a triangle wave. Now replace f on the intervals [1/9,2/9] and [7/9,8/9] with a similar triangle wave. Repeat this process for every interval on which f is zero, and we have a continuous function that vanishes on the Cantor set (which is uncountable), and is nowhere constant. Replacing the triangle wave with a suitable $C^{\infty}$ function yields an infinitely differentiable function that vanishes uncountably many times but is not constant. If you want it to be continuous but nowhere differentiable, replace each triangle wave with such a function instead.
Can you please "formally" define your function? "if we infinitely repeat..." is not a formal term and I am not sure the ultimate function remains a continuous one.
 "if we infinitely repeat..." simply refers to the limit function of the sequence of functions I described. Define $$f_1[a,b](x) = \left\{ \begin{array}{cc} 0 & x \in \left[a,\frac{2a+b}{3}\right]\cup\left[\frac{a+2b}{3},b\right]\\ x-\frac{2a+b}{3} & x \in \left[\frac{2a+b}{3},\frac{a+b}{2}\right]\\ \frac{a+2b}{3}-x & x \in \left[\frac{a+b}{2},\frac{a+2b}{3}\right] \end{array}$$ and $$f_{n+1}[a,b](x) = \left\{ \begin{array}{cc} f_n\left[a,\frac{2a+b}{3}\right](x) & x \in \left[a,\frac{2a+b}{3}\right]\\ x-\frac{2a+b}{3} & x \in \left[\frac{2a+b}{3},\frac{a+b}{2}\right]\\ \frac{a+2b}{3}-x & x \in \left[\frac{a+b}{2},\frac{a+2b}{3}\right]\\ f_n\left[\frac{a+2b}{3},b\right](x) & x \in \left[\frac{a+2b}{3},b\right] \end{array}$$ Then $$f(x) = \lim_{n\to\infty}f_n[0,1](x)$$ is the function I just described.
 Recognitions: Gold Member Science Advisor Staff Emeritus There's a simpler description of (something like) Moo's function: f(x) = [distance from x to the Cantor set] Incidentally, I don't think I've heard "nowhere constant" before -- I would have used the phrase "locally nonconstant".

 Quote by Moo Of Doom "if we infinitely repeat..." simply refers to the limit function of the sequence of functions I described. Define $$f_1[a,b](x) = \left\{ \begin{array}{cc} 0 & x \in \left[a,\frac{2a+b}{3}\right]\cup\left[\frac{a+2b}{3},b\right]\\ x-\frac{2a+b}{3} & x \in \left[\frac{2a+b}{3},\frac{a+b}{2}\right]\\ \frac{a+2b}{3}-x & x \in \left[\frac{a+b}{2},\frac{a+2b}{3}\right] \end{array}$$ and $$f_{n+1}[a,b](x) = \left\{ \begin{array}{cc} f_n\left[a,\frac{2a+b}{3}\right](x) & x \in \left[a,\frac{2a+b}{3}\right]\\ x-\frac{2a+b}{3} & x \in \left[\frac{2a+b}{3},\frac{a+b}{2}\right]\\ \frac{a+2b}{3}-x & x \in \left[\frac{a+b}{2},\frac{a+2b}{3}\right]\\ f_n\left[\frac{a+2b}{3},b\right](x) & x \in \left[\frac{a+2b}{3},b\right] \end{array}$$ Then $$f(x) = \lim_{n\to\infty}f_n[0,1](x)$$ is the function I just described.
Hmm.. each f_n is uniformly continuous, then if the seq {f_n} converges uniformly, the trick is done.
For the triangular waves become more little as n surges up, I think the convergence is uniform. But, can you dfevise a formal, maybe inductive, proof?
 Recognitions: Homework Help Science Advisor If C is a closed uncountable set in R containing no intervals (like the Cantor set), then it's complement is a countable union of disjoint open intervals. Define f to be 0 on C, and f is a triangle of slope with absolute value 1 on each open interval. So let C be the Cantor set. $\mathbb{R} = (-\infty ,0) \sqcup \bigsqcup (a_n,b_n) \sqcup C \sqcup (1,\infty )$. Define $f : \mathbb{R} \to \mathbb{R}$ by: $$f(x)=\left\{\begin{array}{cc}x,&\mbox{ if } x < 0\\ \frac{b_n-a_n}{2} - |x - \frac{b_n+a_n}{2}|, & \mbox{ if } a_n < x < b_n\\ 0, & \mbox{ if } x \in C\\ 1-x, & \mbox{ if } x > 1\right.$$