# Mean value theorem for integrals on (a,b)

The problem is:

Let $g(x)$ be nonnegative on [a,b] and Riemann integrable on [a,b], a function $f$ continuous on (a,b) and the product $fg$ Riemann integrable on [a,b]. Prove, that under these conditions the mean value theorem is true, i.e. there exists a point $\xi\in(a,b)$, such that $\int\limits_a^b f(x)g(x)dx=f(\xi)\int\limits_a^b g(x)dx$.

The hint to the problem from the same book is to use the mean value theorem for the integral $\int\limits^{b-\varepsilon}_{a+\varepsilon}f(x)g(x)dx$ and then apply the equality $\int\limits^b_a f(x)dx=\lim\limits_{\varepsilon_1\to0+}(\lim\limits_{\varepsilon\to0+}\int\limits^{b-\epsilon_1}_{a+\varepsilon}f(x)dx)$. But I don't understand this, because for each $\varepsilon$ is a distinct point $c$ so, $f(c)$ is not a constant, when $\varepsilon\to0$, so we cannot go to a limit in the corresponding mean value equality.

Could somebody, please, clarify this. Is the original statement true or not and how to prove that?

First observe that, since $g\geq 0$ and $g, fg$ are integrable, if $\int_a^b g(x)\, dx = 0$ then also $\int_a^b f(x)g(x)\, dx = 0$. In this case any $\xi \in (a,b)$ does the job.
Let us consider the case $\int_a^b g > 0$. You already know that, for every $\varepsilon\in (0, (b-a)/2)$, there exists a point $\xi_\varepsilon \in [a+\varepsilon, b-\varepsilon]$ such that $$\int_{a+\varepsilon}^{b-\varepsilon} f(x)g(x)\, dx = f(\xi_\varepsilon) \int_a^b g(x)\, dx.$$ Hence, choosing $\varepsilon = 1/n$ you can construct a sequence of points $\xi_n \in [a,b]$ such that $$(1)\quad \int_{a+1/n}^{b-1/n} f(x)g(x)\, dx = f(\xi_n) \int_a^b g(x)\, dx.$$ Since $\int_a^b g > 0$, we deduce that the sequence $(f(\xi_n))$ is convergent, and $$L := \lim_n f(\xi_n) = \frac{\int_a^b fg}{\int_a^b g}.$$ By the Bolzano-Weierstrass' theorem, there exists a subsequence $(\xi_{n_j})$ converging to a point $\xi_0 \in [a,b]$. If $\xi_0 \in (a,b)$ then we are done, since $f(\xi_0) = L$.
Consider now the case $\xi_0 \in \{a, b\}$. To fix the ideas, suppose $\xi_0 = a$. We can extended $f$ with continuity in $a$ by setting $f(a) = L$. We claim that there exists a point $\xi \in (a,b)$ such that $f(\xi) = L$. Namely, if by contradiction this is not the case, then by continuity we would have $f(x) > L$ for every $x\in (a,b)$ or $f(x) < L$ for every $x\in (a,b)$. But, in both cases, it follows that $\int_a^b fg \neq L \int_a^b f$, a contradiction.
• I don't understand your last inequality. From $f(x)>L$ we can only deduce, that $\int_a^b f(x)g(x)dx\ge L\int_a^b g(x)dx$, I can't prove, that it's strictly greater. – Andrei Petrov Dec 2 '17 at 19:48
• $f$ is a continuous functions, so if $f(x_0) > L$ then, setting $\epsilon := (f(x_0) - L) / 2$, there exists an interval $I = [x_0-\delta, x_0+\delta]$ such that $f(x) \geq L + \epsilon$ for every $x\in I$. – Rigel Dec 2 '17 at 20:03
• We also need, that integral from $g$ over that interval was not equal to zero. However, I was able to overcome this difficulty. So, thank you for the nice solution! – Andrei Petrov Dec 3 '17 at 17:48