$f:\mathbb{R}\to\mathbb{R}$, continuous, such that $xf(x)>0$ when $x\neq 0$. Show that $f(0)=0$ I need to prove:
$f:\mathbb{R}\to\mathbb{R}$, continuous, such that $xf(x)>0$ when $x\neq 0$. Show that $f(0)=0$. Show that if we remove the continuity this result will fail. Give an example.
For an example, I thought of $f(x) = x$. This is functinuous, and $xf(x) = x^2>0$ when $x\neq 0$, but I can't make a non continuous version of this function to try. Maybe $f(x) = \frac{x^2-2x}{x-2}$? This functions is not continuous at $x=0$ but it's equal to $x$ everywhere except at $x=0$, so $xf(x)>0$ stills valid, but instead of having $f(0)\neq 0$ we don't even have a definition for $x=0$. Maybe if I define it with any number for $x=0$ it works?
Also, how to prove such result?
I tried considering:
$$g(x) = f(x)-x$$
Somehow if I assume $xf(x)>0$ I need to prove $g(0) = 0$, maybe using the intermediate value theorem. Any ideas? I can't see how $xf(x)>0$ helps.
 A: HINT: Since $xf(x)>0$ whenever $x\ne 0$, you know that $f(x)>0$ when $x>0$, and $f(x)<0$ when $x<0$. (Why?) What does this say about $\lim\limits_{x\to 0^-}f(x)$ and $\lim\limits_{x\to 0^+}f(x)$?
A: $xf(x) > 0$ implies that $f(x) > 0$ when $x$ is positive and $f(x) < 0$ when $x$ is negative.
By intermediate value theorem, we must have $f(c) = 0$ at some value between a negative and positive number, since we know it is non-zero everywhere else it must occur at zero.
A: Since $f$ is continuous, if $f(0)=a\gt0$, then there is an $\epsilon\gt0$ so that for $|x|\le\epsilon$
$$
f(x)\ge\frac a2
$$
Then for $-\epsilon\le x\lt0$,
$$
xf(x)\lt0
$$
which contradicts the hypothesis.
If $f(0)=a\lt0$, then there is an $\epsilon\gt0$ so that for $|x|\le\epsilon$
$$
f(x)\le\frac a2
$$
Then for $0\lt x\le\epsilon$,
$$
xf(x)\lt0
$$
which contradicts the hypothesis.
Thus, we are left with the conclusion that $f(0)=0$.
A: f(x) is negative whenever x is negative and positive whenever x is positive. By intermediate value theorem f(0)=0.
