Proof (mean value theorem for integrals)
We apply Cauchy mean value theorem to $$ \begin{align*} F(x) = \int_{a}^{x} fg, \quad G(x) = \int_{a}^{x} g \end{align*} $$ to deduce there is some $c\in(a,b)$ such that $$ \begin{align*} \left(F(b) - F(a)\right) G'(c) = F'(c) \left(G(b) - G(a)\right). \end{align*} $$ By the fundamental theorem of calculus, $F'(c) = f(c)g(c)$ and $G'(c) = g(c)$. Therefore $$ \begin{align*} \left(\int_{a}^{b} fg\right) g(c) = f(c)g(c) \int_{a}^{b} g \end{align*} $$ but $g(c) \neq 0$ so we can cancel.