There seem to be a number of theorems that call themselves "the Second Mean Value Theorem for Integrals," but the statement my textbook has is the following:
Let $f$ and $g$ be continuous on $[a,b]$ and let $g$ be nonnegative. Then there is a number $c\in(a,b)$ such that$$\int_a^b {f(x)g(x)}dx = f(c) \int_a^b {g(x)} dx.$$
Many of the questions asked on the site seem to have a statement that has more conditions on $f$ or $g$ (like monotonicity), and the equality seems to take different forms too, so I'm not sure how well they apply to this case. I have managed to use Cauchy's MVT to prove the case where $g(x)$ is never $0$, and then I did the following for the case where $g(x)$ is $0$ at some point in $[a,b]$:
\begin{align*}\forall x\in[a,b], \exists m,M\in\mathbb{R}: m\le f(x) \le M &&&\text{Extreme Value Theorem on $f$} \\mg(x)\le f(x)g(x)\le Mg(x) &&&\text{$g(x)$ nonnegative} \\\int_a^b {mg(x)} dx \le \int_a^b {f(x)g(x)} \le \int_a^b {Mg(x)} dx &&&\text{monotonicity of integral} \\m\le \frac{\int_a^b {f(x)g(x)} dx}{\int_a^b {g(x)} dx} \le M &&&\text{$g(x)\ne0$ somewhere, $g$ continuous, so $\int g\ne0$} \\\exists c_m,c_M\in[a,b]: f(c_m)=m, f(c_M)=M &&&\text{EVT on $f$} \\\exists c\in[\min\{c_m,c_M\},\max\{c_m,c_M\}]: f(c)= \frac{\int_a^b {f(x)g(x)} dx}{\int_a^b {g(x)} dx} &&&\text{by Intermediate Value Theorem on $f$}\end{align*}
Assuming these steps are correct, I seem to be close. However, I am searching for a $c\in(a,b)$. Right now I have found a $c\in[a,b]$. If I could argue that $c\ne a$ and $c\ne b$ then I would be done, but I have no idea why that might be true.
Any guidance would be much appreciated.