# Interval around a root of a function

I have a question that may seems stupid and obvious, but for me it's not. The question is the following:

Edit: I've explained bad my question

Suppose we have $f: \Bbb{R} \to \mathbb{R}$ a non constant continuous differentiable function on $\Bbb{R}$. Suppose also that we have $x_0 \in \Bbb{R}$ and that $f(x_0) = 0$. Is it true that $f$ is equal to $0$ only in $x_0$?

This means: is it possible to find a non constant function that for some point $x_0$ is equal to $0$ and that is equal to $0$ also for the point in $[x_0 - \epsilon, x_0 + \epsilon]$?

2nd edit:

It seems everyone is thinking about the function $x \sin(\frac1x)$ but this function, tell me if I'm wrong, is equal to zero only for singular points. There doesn't exist an interval $[a,b]$ such that $\forall x \in [a,b] x\sin(\frac1x) = 0$

-
Your 'i.e.' isn't the same as what's above at all. – Git Gud Mar 12 '14 at 19:51
You seem to be asking quite a few very related questions at once here. First of all, a function can be non-constant in general, and continuously differentiable, yet constantly equal to $0$ on some interval around $x_0$. It is also very possible for the function to be zero infinitely many times, infinitely close to $x_0$, yet not constantly zero, take for instance $f(x) = x^2\sin(1/x)$ (with the extension $f(0) = 0$) around $x_0 = 0$. – Arthur Mar 12 '14 at 19:53
Again, post edit, the two formulations of the question ask different things. – Git Gud Mar 12 '14 at 19:56
After the second edit, I have this to say: people are answering the first question. You're asking two different questions without realizing it. – Git Gud Mar 12 '14 at 20:00
@GitGud is it better now? Do you understand what I mean? – Bman72 Mar 12 '14 at 20:00

It is not always true. Let $f(x)=x^2\sin(1/x)$ when $x\ne 0$, and let $f(0)=0$.

Note that $f(x)=0$ whenever $x=\frac{1}{n\pi}$, where $n$ is a non-zero integer.

In this example, $f$ is differentiable at $0$ but the derivative is not continuous at $0$. We can fix that if we want by using $x^3\sin(1/x)$.

Added: The question has been clarified. Perhaps it asks now whether we can have a function which is everywhere differentiable, is not identically $0$, but is identically $0$ in some interval. The answer is yes, and such functions are even useful.

Let $g(x)=e^{-1/x^2}$ when $x\gt 0$, and let $g(x)=0$ for $x\lt 0$. Then $g(x)$ is everywhere differentiable, infinitely often.

Using $g(x)$, we can construct a function $f(x)$ which is is everywhere differentiable infinitely often, is $0$ in the interval $[-1,1]$, and non-zero when $|x|\gt 1$.

-
I've edited the question: it seems I've explained it bad ;-) – Bman72 Mar 12 '14 at 19:55
Of course, if he just wants to see a $C^1$ function, you can also take $g(x)=x^2$ for $x\ge 0$ and $g(x)=0$ for $x<0$ (but that function is clearly not $C^2$). – Jeppe Stig Nielsen Mar 13 '14 at 0:13
For "finite" degree of smoothness, we can use simpler examples of the kind you mention. I wanted to go "all the way." – André Nicolas Mar 13 '14 at 0:59

The function $g(x)=\begin{cases} e^{-1/x^2} & x<0\\0 & x\geq 0\end{cases}$ is differentiable (in fact, it is $C^{\infty}$). By properly shifting, you can get a differentiable $g$ such that $g(x)=0$ for all $x$ in some interval $[a,b]$.

To compute explicitly, we can do the following:

$$f(x)=\begin{cases} e^{-1/x^2} & x<0 \\ 0 & x\in[0,1] \\ e^{-1/(x-1)^2} & x>1 \end{cases}$$ The function $f$ is differentiable ($C^{\infty}$, I'll leave it to you) and satisfies $f(x)=0$ on the interval $[0,1]$.

-
What do you mean by properly shifting? and second this function is constant for $x\ge 0$ – Bman72 Mar 12 '14 at 20:01
just be a bit more creative! I added more to my answer – doppz Mar 12 '14 at 20:04
@Ale You did ask for a function that is constant in an interval. – Christopher Creutzig Mar 12 '14 at 23:19
@ChristopherCreutzig Actually no. I was more interested in finding a function with those properties that is nowhere constant. But however I've understood something that helped me solve a problem that I had. – Bman72 Mar 13 '14 at 7:33
@Ale A function that is nowhere constant will not have the property that it is zero at every point in $[x_0-\epsilon, x_0+\epsilon]$, since then it would be constant in this interval. – Christopher Creutzig Mar 13 '14 at 17:31

If I have understood your question correctly, then this is wrong. Counter-example: $\sin(x)$. It is non-constant, differentiable everywhere, and is $0$ at $x_0=0$. Your question apparently asks us to prove that this is the only place where the function is zero, which in fact is false, because $f(x)=0 \quad\forall x=n\pi ,n\in \mathbb N$.

EDIT: Following the edit, the question now seems to be that is it possible to find $f(x)$ such that $f(x)$ is zero for $x_0$ and also zero for some $x\in[x_0 - \epsilon,x_0+\epsilon]$ for arbitrarily small $\epsilon$. Clearly yes, since

$$f(x)=\begin{cases} x^2\cdot\sin(\frac{1}{x})&x\ne0\\ 0&x=0\\ \end{cases}$$

fits the condition, as many people have observed.

EDIT 2:

It seems the OP's question is "Is it possible that a non-constant function be zero on an entire interval?"

Indeed it is. Consider the function $$f(x)=\begin{cases} (x+1)^2&x\lt-1\\ 0&x \in [-1,1]\\ (x-1)^2&x\gt1\\ \end{cases}$$

This function is non constant, differentiable everywhere, and is zero $\forall x\in [-1,1]$

-
I've edited the question: it seems I've explained it bad ;-) – Bman72 Mar 12 '14 at 19:56
@Ale updated. :) – Sabyasachi Mar 12 '14 at 20:02
you say for some $x\in[x_0 - \epsilon,x_0+\epsilon]$ but I mean forall – Bman72 Mar 12 '14 at 20:05
@Ale Is your question that is it possible for a non constant function to be zero on an entire interval? – Sabyasachi Mar 12 '14 at 20:08

No, because of bolzano, it only tells that exist one solution but maybe it can have more for example sin(x) is a diferentiable function and you ha 0 is a root but 180 are root too.

-
Nitpick: 180 is not a zero of sin(x). 180°, which equals π, is. (This is a math site, after all.) – Christopher Creutzig Mar 12 '14 at 23:17