Let $f: [a,b] \to \mathbb{R}$ be continuous and suppose $g$ is integrable on $[a,b]$. Assume $g(x) \geq 0$ for all $x \in [a,b]$. Prove there exists some $c \in [a,b]$ such that $$ \int_a ^b f(x)g(x) dx = f(c) \int_a ^b g(x) dx.$$
Since $g$ is integrable, there exists a partition $P$ of $[a,b]$ such that $U(P,f) - L(P,f) = \sum_{i=1}^n (M_i-m_i) \Delta x_i < \epsilon$, where $M_i = \sup \{f(t): x_{i-1} \leq t \leq x_i \}$ and $m_i = \inf \{f(t): x_{i-1} \leq t \leq x_i \}$. Since $f$ is continuous, $f$ is also integrable. How can I proceed/conclude the statement that I need to prove? I am using baby Rudin Analysis.
$f:[a,b]\to \mathbb R$ continuous. So, $f$ attain its bounds. $\exists x_*$ and $x^* \in [a,b]:f(x_*)= \inf\{f(x):x\in[a,b]\}$ and $f(x^*)= \sup\{f(x):x\in[a,b]\}$. $f(x_*)g(x)\le f(x)g(x) \le f(x^*)g(x).$ Assume that $\int_a^b g(x)dx>0$(Else, it is trivially true) then $f(x_*)\le \frac{\int_a^b f(x)g(x)dx}{\int_a^b g(x)dx} \le f(x^*)$. Applying Intermediate Value theorem. We get desired result.