TITLE: How to prove the second mean value theorem for definite integrals
QUESTION [10 upvotes]: It's a variant form of the second mean value theorem.
[Theorem] If $f$ is integrable on [a, b],
(i) if $g$ is monotonically decreasing on [a, b], and $g(x)\ge0$, then there exists $e\in[a,b]$, that$$
\int_a^bf(x)g(x)dx=g(a)\int_a^ef(x)dx
$$(ii) if $g$ is monotonically increasing on [a, b], and $g(x)\ge0$, then there exists $e\in[a,b]$, that$$
\int_a^bf(x)g(x)dx=g(b)\int_e^bf(x)dx
$$
[Question] My text book gave the proof to (i). A similar approach should do (ii), but I can't prove (ii). Here is the proof to (i).
[Proof to (i)] Let $$
\begin{align}
F(x)=\int_a^xf(t)dt, &&x\in[a,b]
\end{align}
$$We can know that $F$ is continuous on [a, b], and is bounded, let's say by [m, M]. If $g(a)=0$, then $g(x)\equiv0$, then (i) is obviously true. So let's assume $g(a)>0$. So proving (i) becomes proving the following,
$$
\begin{align}
m\le\frac 1 {g(a)}\int_a^bf(x)g(x)dx\le M &&(1)
\end{align}
$$
From intermediate value theorem for continuous functions, if (1) held, then there exists $e \in [a,b]$ that
$$
F(e)=\int_a^e f(t)dt=\frac 1 {g(a)} \int_a^b f(x)g(x)dx
$$
In this case, (i) is proved.
(1) is equivalent to$$
\begin{align}
mg(a)\le\int_a^bf(x)g(x)dx\le Mg(a)
\end{align}
$$Now prove this inequality.
$f$ is integrable, so $f$ is bounded, let $|f(x)|\le L$. $g$ is monotonic, so is  integrable. So there exists a split $T:\ a=x_0<x_1<x_2<...<x_n=b$, for any $\epsilon>0$ that$$
\sum_T \omega_i^g\Delta x_i<\epsilon/L
$$where $\omega$ is the oscillation of $g$ on $\Delta x_i$
$$
\begin{align}
I &= \int_a^b f(x)g(x)dx\\
&= \sum _{i=1}^n\:\int _{x_{i-1}}^{x_i}\left[g\left(x\right)-g\left(x_{i-1}\right)\right]f\left(x\right)dx+\sum _{i=1}^ng\left(x_{i-1}\right)\int _{x_{i-1}}^{x_i}f\left(x\right)dx\\
&= I_1+I_2\\
|I_1| & \le \sum _{i=1}^n\int _{x_{i-1}}^{x_i}\left|g\left(x\right)-g\left(x_{i-1}\right)\right|\cdot \left|f\left(x\right)\right|dx\\
& \le L\cdot \sum _{i=1}^n\omega _i^g\Delta x_i\\
& \le L\cdot \frac \epsilon L = \epsilon
\end{align}
$$So $I_1$ is negligible. We concentrate on $I_2$. First we should know$$
S_i=\int _{x_{i-1}}^{x_i}f\left(x\right)dx=\int _{a}^{x_i}f\left(x\right)dx-\int _{a}^{x_{i-1}}f\left(x\right)dx=F(x_i)-F(x_{i-1})
$$
$$
\begin{align}
I_2&=\sum _{i=1}^ng\left(x_{i-1}\right)S_i\\
&=\sum _{i=1}^ng\left(x_{i-1}\right)[F(x_i)-F(x_{i-1})]\\
&=g(x_0)[F(x_1)-F(x_0)]+...+g(x_{n-1})[F(x_n)-F(x_{n-1})]\\
&=F\left(x_1\right)\left[g\left(x_0\right)-g\left(x_1\right)\right]+...+F\left(x_{n-1}\right)\left[g\left(x_{n-2}\right)-g\left(x_{n-1}\right)\right]+F\left(x_n\right)g\left(x_{n-1}\right)-F(x_0)g(x_0)\\
&=\sum _{i=1}^{n-1}F\left(x_i\right)\left[g\left(x_{i-1}\right)-g\left(x_i\right)\right]+F\left(b\right)g\left(x_{n-1}\right)-F(a)g(x_0)\\
&=\sum _{i=1}^{n-1}F\left(x_i\right)\left[g\left(x_{i-1}\right)-g\left(x_i\right)\right]+F\left(b\right)g\left(x_{n-1}\right)\:\:\:\:\:\:\:\:\:(F(a)=0)
\end{align}
$$
$g(x) \ge 0$ and monotonically decreasing, so $g(x_{n-1}) \ge 0,\ g(x_{i-1})-g(x_i) \ge 0,\ i=1,2,...,n-1$. From $F(x_i) \le M,\ i=1,2,...,n$, we have
$$
I_2 \le M\sum _{i=1}^{n-1}\left[g\left(x_{i-1}\right)-g\left(x_i\right)\right]+Mg\left(x_{n-1}\right)=Mg\left(a\right)
$$
Similarly, from $F(x_i) \ge m,\ i=1,2,...,n$, we have $I_2 \ge mg(a)$. (i) proved.
[My effort] To prove (ii), rewrite$$
\begin{align}
&F(x)=\int_x^b f(t)dt\\
&S_i=\int _{x_{i-1}}^{x_i}f\left(x\right)dx=\int _{x_{i-1}}^{b}f\left(x\right)dx-\int _{x_i}^{b}f\left(x\right)dx=F(x_{i-1})-F(x_i)
\end{align}
$$
So
$$
\begin{align}
I_2&=\sum _{i=1}^ng\left(x_{i-1}\right)\left[F\left(x_{i-1}\right)-F\left(x_i\right)\right]\\
&=g\left(x_0\right)\left[F\left(x_0\right)-F\left(x_1\right)\right]+g\left(x_1\right)\left[F\left(x_1\right)-F\left(x_2\right)\right]+...+g\left(x_{n-1}\right)\left[F\left(x_{n-1}\right)-F\left(x_n\right)\right]\\
&=F\left(x_1\right)\left[g\left(x_1\right)-g\left(x_0\right)\right]+F\left(x_2\right)\left[g\left(x_2\right)-g\left(x_1\right)\right]+...+F\left(x_{n-1}\right)\left[g\left(x_{n-1}\right)-g\left(x_{n-2}\right)\right]-F\left(b\right)g\left(x_{n-1}\right)\\
&=\sum _{i=1}^{n-1}F\left(x_i\right)\left[g\left(x_i\right)-g\left(x_{i-1}\right)\right]-F\left(b\right)g\left(x_{n-1}\right)
\end{align}
$$
Now, I'm stuck. Because it's a subtraction, not a summation, I can' further reduce $I_2$ to $Mg(b)$.
Many thanks!

REPLY [7 votes]: (ii) follows from (i) just by changing the orientation of the integration. More specifically, use (i) for $\tilde{g}(x)=g(a+b-x)$ and $\tilde{f}(x)=f(a+b-x)$. Note $\tilde{g}$ is decreasing when $g$ is increasing, applying (i), there is $e'\in[a,b]$ such that
$\int_a^b\tilde{g}(x)\tilde{f}(x)dx=\tilde{g}(a)\int_a^{e'}\tilde{f}(x)dx$. So, 
$$\int_a^b g(a+b-x)f(a+b-x)dx=g(b)\int_a^{e'}f(a+b-x)dx.$$
After a change of variable $t=a+b-x$, we get 
$$\int_a^b g(t)f(t)dt=g(b)\int_{a+b-e'}^bf(t)dt.$$
Hence, $e=a+b-e'$ works.