Endpoint mixture identity for a monotone weighted integral (source code)

= Endpoint mixture identity for a monotone weighted integral
{title2=$\int_a^bfg=f(a)\int_a^dg+f(b)\int_d^bg$}

If $f,g:[a,b]\to\mathbb R$ are <continuous functions>, $g\geq0$, and $f$ is a nondecreasing <monotonic function>, there is $d\in[a,b]$ satisfying the identity in the title. It expresses the weighted <integral> as a mixture of the two endpoint values of $f$, with the split occurring in the accumulated weight.

Put $G=\int_a^bg$ and $I=\int_a^bfg$. The <monotonicity of the Riemann integral> gives $f(a)G\leq I\leq f(b)G$. The <function> $H(x)=\int_a^xg$ is <continuous>; indeed, $|H(y)-H(x)|\leq\max_{[a,b]}|g|\,|y-x|$ by the <extreme value theorem> and the <triangle inequality> for the <Riemann integral>. Therefore
$$
K(x)=f(a)H(x)+f(b)(G-H(x))
$$
is <continuous>, with $K(a)=f(b)G$ and $K(b)=f(a)G$. The <intermediate value theorem> gives $K(d)=I$. If the endpoint values coincide, the bounds force $I$ to have that common value and an endpoint works. The proof covers zero total weight and a degenerate <interval> without division.