Let $f,g:[a,b] \to \mathbb{R}$ continuous, $g(x)>0 \forall x \in [a,b]$. Then there is $c \in (a,b)$ such that $\int_{a}^{b} f(x)g(x)dx = f(c)\int_{a}^{b} g(x)$
My attempt:
By mean value of integration, as $fg$ is continuous on $[a,b]$, there is $c \in (a,b)$ such that $\int_{a}^{b}f(x)g(x)dx=f(c)g(c)(b-a)$
Also there is $d \in (a,b)$ such that $\int_{a}^{b}g(x)dx=g(d)(b-a)$
If I could make $c=d$, then it would be done, because then $f(c)g(c)(b-a) = f(c)\int_{a}^{b} g(x)$. But I think I can't just choose them to be equal. Also I am not using $g(x)>0$, so definitely there is something wrong with my attempt.
Thanks.