If $\int_a^bg(x)dx=0$, show that $\int_a^bf(x)g(x)dx=0.$ Let $g(x)\ge0$. If $\int_a^bg(x)dx=0$, show that $\int_a^bf(x)g(x)dx=0,$ where $f$ is any integrable function.
If simeone is allowed to use the Mean Value thorem for integrals, the proof is at hand. But for that $f$ must be continuous!
Any suggestion? 
 A: This is about Riemann integration, so $f,g$ are necessarily bounded. 
We'll use that. 
$$\int_a^b f g dx =\int_a^b \underset{\mbox{nonnegative}}{\underbrace{(f - \inf f)}} g dx+ (\inf f )\underset{=0}{\underbrace{\int_a^b  g dx}} $$ 
so the problem is reduced to Riemann integrable nonnegative $f$. For such $f$
$$ 0\le \int_a^b g f dx \le (\sup f) \int_a^b g dx =0.$$ 
A: Since $g(x)\ge0$ and $\int_{a}^bg(x)=0$, then for every $\epsilon>0$, $m(\{x:g(x)\ge\epsilon\})=0$ where $m$ denotes the Lebesgue measure on $\mathbb R^1$. Set $\int_a^b |f(x)|dx=M<\infty$ since $f(x)$ is integrable.
\begin{align}
\int_a^b |f(x)g(x)|dx&=\int_a^b |f(x)|g(x) \chi_{\{x:g(x)<\epsilon\}}dx+\int_a^b |f(x)|g(x)\chi_{\{x:g(x)\ge \epsilon\}}dx\\
&\le \epsilon\int_a^b |f(x)|dx\\
&=\epsilon M
\end{align}
Since $\epsilon$ can be arbitrary small, we conclude that $\int_a^bf(x)g(x)dx=0$.

Or you may use the idea above to prove that $g(x)=0$ a.e. To do this, note that we can decompose the set $\{x:g(x)>0\}$ as

 $$\displaystyle{\{x:g(x)>0\}=\bigcup_{n=1}^\infty\{ x: g(x)\ge\frac 1n \}}$$

and note that

 $$ m(\{x:g(x)>0\})\le\sum_{n=1}^\infty m(\{ x: g(x)\ge\frac 1n \})=0 .$$

We can conclude that $g(x)=0$ a.e. This will give you $\int_a^b f(x)g(x)dx=0.$
A: I try to prove this without invoking anything about Lebesgue integral. Moreover, I do not assume the fact that $fg$ is Riemann integrable nor the inequality $| \int_a^b f(x)g(x) dx | \leq \int_a^b |f(x)g(x)|dx$.
$f$ is Riemann integrable $\Rightarrow$ $f$ is bounded. Choose
$M>0$ such that $|f(x)|\leq M$ for all $x\in[a,b]$. Let $\varepsilon>0$
be given. Choose $\delta>0$ such that for any partition $\mathbb{P}=\{x_{0},x_{1},\ldots,x_{n}\}$
of $[a,b]$ (with $a=x_{0}<x_{1}<\ldots<x_{n}=b$) and any $\xi_{i}\in[x_{i-1},x_{i}]$,
if $||\mathbb{P}||<\delta$ (here, $||\mathbb{P}||=\max_{1\leq i\leq n}|x_{i}-x_{i-1}|$),
then 
$$
\left|\sum_{i=1}^{n}g(\xi_{i})(x_{i}-x_{i-1})-\int_{a}^{b}g(x)dx\right|<\frac{\varepsilon}{M}.
$$
That is, 
$$
\left|\sum_{i=1}^{n}g(\xi_{i})(x_{i}-x_{i-1})\right|<\frac{\varepsilon}{M}.
$$
Now, let $\mathbb{P}=\{x_{0},x_{1},\ldots,x_{n}\}$ be an arbitrary
partition of $[a,b]$, with $a=x_{0}<x_{1}<\ldots<x_{n}=b$, that
satisfies $||\mathbb{P}||<\delta$. Let $\xi_{i}\in[x_{i-1},x_{i}]$
be arbitrary. Then 
\begin{eqnarray*}
 &  & \left|\sum_{i=1}^{n}f(\xi_{i})g(\xi_{i})(x_{i}-x_{i-1})-0\right|\\
 & \leq & \sum_{i=1}^{n}|f(\xi_{i})g(\xi_{i})|(x_{i}-x_{i-1})\\
 & \leq & M\sum_{i=1}^{n}g(\xi_{i})(x_{i}-x_{i-1})\\
 & < & M\cdot\frac{\varepsilon}{M}\\
 & = & \varepsilon.
\end{eqnarray*}
This shows that the Riemann integral $\int_{a}^{b}f(x)g(x)dx$ exists
and $\int_{a}^{b}f(x)g(x)dx=0$.
A: Define
$$
\begin{align}
p_n(x)
&=\frac{|x-n|-|x-n-1|-|x+n|+|x+n+1|}2\\[6pt]
&=\left\{\begin{array}{cl}
-1&\text{if }x\lt-n-1\\
x+n&\text{if }-n-1\le x\lt-n\\
0&\text{if }-n\le x\lt n\\
x-n&\text{if }n\le x\lt n+1\\
1&\text{if }n+1\le x
\end{array}\right.
\end{align}
$$
In particular, $p_n$ is continuous, so that $p_n(f)$ is integrable. Furthermore,
$$
\begin{align}
\sum_{k=0}^{n-1}p_k(x)
&=\frac{|x+n|-|x-n|}2\\
&=\left\{\begin{array}{cl}
-n&\text{if }x\lt-n\\
x&\text{if }-n\le x\lt n\\
n&\text{if }n\le x\\
\end{array}\right.
\end{align}
$$
Therefore,
$$
\begin{align}
\left|\int_a^bf(x)\,g(x)\,\mathrm{d}x\right|
&=\left|\sum_{n=1}^\infty\int_a^bp_n(f(x))\,g(x)\,\mathrm{d}x\right|\\
&\le\sum_{n=1}^\infty\int_a^b|p_n(f(x))|\,g(x)\,\mathrm{d}x\\
&\le\sum_{n=1}^\infty\int_a^b\,g(x)\,\mathrm{d}x\\
&=\sum_{n=1}^\infty0\\[6pt]
&=0
\end{align}
$$
Note that if $f$ is finite, then the sum above is finite.
