I came across this question in a book:
Suppose $f(.)$ and $g(.)$ be two continuous functions in $\left[a,b\right]$. Assume that $g(.)$ does not change sign in $\left[a,b\right]$. Show that $\exists$ $c\in\left[a,b\right]$ such that $$\intop_{a}^{b}f\left(x\right)g\left(x\right)dx=f\left(c\right)\intop_{a}^{b}g\left(x\right)dx$$
I attempted in the following way:
Let $h\left(x\right)=f\left(x\right)g\left(x\right)\forall x\in\left[a,b\right]$. Then, $\exists $ $c\in\left[a,b\right]$ such that $\frac{1}{b-a}\intop_{a}^{b}h\left(x\right)dx=h\left(c\right)$. Also, as $g\left(x\right)$ is continuous in $\left[a,b\right]$, $g\left(x\right)$ is differentiable on $\left[a,b\right]$. Thus, $\exists$ $c'\in\left[a,b\right]$ such that $\frac{1}{b-a}\intop_{a}^{b}g\left(x\right)dx=g\left(c'\right)$.
But the problem I faced now is that, in general, $c\neq c'$. Had that been the case, then I could've just divided the two equations found above and conclude the result. So my question is, given the information in the question and what I have done above, is it true that $c=c'$ always? I seem to have run out of ideas here, so a little bit hint would be very much appreciable.
P.S.: I later did this problem in the following manner-
Let $I=\left[a,b\right]$ and $f\left(I\right)=\left\{f\left(x\right):x\in\left[a,b\right]\right\}$. Also, let us define $m=\inf f\left(I\right)$ and $M=\sup f\left(I\right)$. Then, $\forall x\in\left[a,b\right]$,
$$m\leq f\left(x\right)\leq M\\ m.g\left(x\right)\leq f\left(x\right).g\left(x\right)\leq M.g\left(x\right)\\ m\int_a^b{g\left(x\right)}dx\leq \int_a^b{f\left(x\right)g\left(x\right)}dx\leq M\int_a^b{g\left(x\right)}dx\\ m\leq \frac{\int_a^b{f\left(x\right)g\left(x\right)}dx}{\int_a^b{g\left(x\right)}dx}\leq M\\ $$
Thus, using the Intermediate Value Theorem,
$\exists$ $c\in\left[a,b\right]$ such that $f\left(c\right)=\frac{\int_a^b{f\left(x\right)g\left(x\right)}dx}{\int_a^b{g\left(x\right)}dx}$ and thus it completes the proof.
But I am still in doubt regarding my first method.