# How to prove that a continuous function is identically zero over $\mathbb{R}$?

The following problem is given at the level of a senior undergrad analysis course:

We are given a continuous function $g:\mathbb{R}\rightarrow \mathbb{R}$. Assume that $\mathbb{R}$ contains a countably infinite subset $G$ such that:$\int_{a}^{b}g(x)dx=0$ if $a$ and $b$ are not in $G$. Prove that $g$ is the zero function.

My attempt: Without loss of generality, I assume that my function has only one positive part and one negative part over $\mathbb{R}$. I broke my function $g(x)$ into two functions: $g_{+}(x)$ which is equal to $0$ when $g(x)$ is negative and equals $g(x)$ when $g(x)$ is positive. Similarly, I define $g_{-}(x)$ to be zero when $g(x)$ is positive and equals $g(x)$ when $g(x)$ is negative. Now, I call $A_{+}$ the subset of $\mathbb{R}$ where $g(x)$ is positive, and $A_{-}$ the subset of $\mathbb{R}$ where $g(x)$ is negative. Then, I am trying to prove that for any $a< b$ in $A_{+}$: $\int_{a}^{b}g_{+}(x)dx=0$ (This obvious if $a$ and $b$ are not in $G$, but the problem is when one or both of them is/are not in $G$) and since $g_{+}(x)\geq 0$ for any $x\in \left [ a,b \right ]$, then $g_{+}(x)=0$ for all $x\in \left [ a,b \right ]$. The same thing applies to the negative part. So, I am stuck at this point.

Can anyone tell how to move forward and solve the problem? Also, if anyone has an easier way to solve the problem, please share.

-
Are your integrals Riemann integrals? –  hardmath Apr 7 '12 at 21:47
@hardmath: The integrand is continuous. –  Harald Hanche-Olsen Apr 7 '12 at 21:51

Assume for contradiction that $g(x)$ is somewhere nonzero, so without loss of generality, let $g(0) = c > 0$. Then by continuity, there is a neighborhood of $0$ where $g$ is within a certain range of $c$, like $g(x) > c/2$ on $(-\epsilon, \epsilon)$. The complement of $G$ is dense over $\mathbb{R}$, so pick two points $a < b \in (-\epsilon, \epsilon)$ which are not in $G$, and look at the integral $$\int_a^b g(x)dx.$$ To show that the complement of $G$ is everywhere dense, you might need to use another proof by contradiction. If it weren't dense, then $G$ would have a contiguous interval somewhere, i.e. a set of positive measure, which would necessarily be uncountable.

Hope that helps!

-

Assume that $g(x_0)\neq 0$ for some $x_0\in\mathbb R$. Without loss of generality, we can assume that $g(x_0)>0$, otherwise consider $-g$. By continuity, we can find a $\delta>0$ such that if $|x-x_0|\leq \delta$ then $g(x)\geq \frac{g(x_0)}2$. Since $(x_0-\delta,x_0)$ and $(x_0,x_0+\delta)$ are uncountable, we can find $a\in (x_0-\delta,x_0)\cap G^c$ and $b\in (x_0,x_0+\delta)\cap G^c$. We get that $$0=\int_a^bg(x)dx\geq (b-a)\frac{g(x_0)}2>0,$$ a contradiction.

-

The complement of $G$ is dense in $\mathbb{R}$, and the integral is a continuous function of $a$ and $b$.

-