Let $f:[a, b] \rightarrow \mathbb{R}$ be a monotonic function and $g:[a, b] \rightarrow \mathbb{R}$ be either a nonnegative integrable function or a continuous function. Show that there is $c \in[a, b]$ such that
$$
\int_{a}^{b} f(x) g(x) d x=f(a) \int_{a}^{c} g(x) d x+f(b) \int_{c}^{b} g(x) d x
$$
Give an example to show that the monotonicity of $f$ cannot be omitted. (Hint: Without loss of generality, suppose $f$ is (monotonically) increasing. Let $G(x):=\int_{a}^{x} g(t) d t$ for $x \in[a, b] .$ If $g$ is a nonnegative integrable function, then $f(a) G(b) \leq \int_{a}^{b} f(x) g(x) d x \leq f(b) G(b)$. If $g$ is continuous, use Exercise 49.)