Prove that if the functions $g,h:[a,b] \rightarrow \mathbb{R}$ are continuous, with $h(x) \geq 0$ for all $x\in[a,b]$, then there is a point $c$ in $(a,b)$ such that $\int_a^bh(x)g(x)dx=g(c)\int_a^bh(x)dx$.
At first I tried to use the Cauchy Mean Value Theorem, by letting $A(x) =\int_a^xh(t)g(t)dt$ and $B(x) =\int_a^xh(t)dt$. Then by CMVT, we have that there exists a point $c$ such that $$\frac{ \int_a^bh(x)g(x)dx }{ \int_a^bh(x)dx}= \frac{h(c)g(c)}{h(c)}=g(c) $$, and the result follows But this only holds if $h(x)$ is never $0$, which we dont have. So is this the wrong way to do this?