Let $ f : [a, b] \to \mathbb{R} $ and $ g : [a, b] \to \mathbb{R} $ be functions such that $ f$ is continuous and $ g $ is monotonic, continuously differentiable, and non-negative on the interval $ [a, b] $. Prove that there exists $ \xi \in [a, b] $ such that$$\int_a^b f g \, dx = g(a) \int_a^\xi f \, dx + g(b) \int_\xi^b f \, dx.$$
I thing we should define: $$F(x)=\int_{a}^{x}fdt$$
And eventually use the mean value theorem on $ F $; however, I don't know how to relate $ F(x)$ with:
$$H(x)=\int_{a}^{x}fgdx$$
Technically if $\int_a^b f g \, dx = g(a) \int_a^\xi f \, dx + g(b) \int_\xi^b f \, dx$:
$$H(b)=(g(a)-g(b))F(\xi)+g(b)F(b)$$
Maybe in some way that I’m not seeing, it can be derived from the Mean Value Theorem. Moreover, to apply the Mean Value Theorem, we need to be clear about how the product behaves, because although I can assume𝑔g is monotonically increasing with $g(a)\leq g(x)\leq g(b)$, I don't know between which values $f(x)g(x)$ lies, since $f$ could be negative.