Question about condtion of MVT for integral. For $f \in C[a,b], g\ge0$ (or $g\le0$) on $[a,b]$, then there exists $c\in(a,b)$ $\int _a^b f(x)g(x)dx = f(c)\int_a^bg(x)dx$. 
It is MVT for integral.
Why $c \in (a,b)$ ? How about $c\in[a,b]$? Is it wrong?
I am wondering this because, in proving progress, 
by IVT, there exist $m,M$ s.t $m\le f(x)\le M$ 
so $m\int_a^bg(x)dx$ $\le$ $\int_a^b f(x)g(x)dx$ $\le$ $M\int_a^bg(x)dx$.
when $\int_a^bg(x)dx>0$ then $m\le$ $\frac{\int_a^b f(x)g(x)dx} {\int_a^bg(x)dx}$   $\le$  $M$ and 
$\frac{\int_a^b f(x)g(x)dx} {\int_a^bg(x)dx}$ becomes $f(c)$, so it seems $c\in [a,b]$ might work.
So, I want to know why $c\in(a,b)$, or $c\in[a,b] $ would be okay.
 A: In the book Mathematical Analysis I by Vladimir A. Zorich (p. 352) I found:

As far as I can tell from the proof in the book, the proof depends on the intermediate value theorem, which states 

But $c \in (a,b)$, since if either $f(a) = 0$ or $f(b) = 0$ would imply $f(a)f(b) = 0$ and so the function would not fulfill the hypothesis of the intermediate value theorem. Thus in fact it is $c \in (a,b)$, but $(a,b) \subseteq [a,b]$. Hence we can use $[a,b]$.
A: First of all, OP is correct in his conclusion that $c \in [a, b]$ and not that $c \in (a, b)$. +1 goes to OP whose has such powers of observation.
But the catch is that we can prove the MVT for integrals in a way such that $c \in (a, b)$. The method of proof used in question is based on the theorem that a continuous function takes every value between its minimum and maximum values on a closed interval. If you use this method of proof then you can only guarantee $c \in [a, b]$.
A proper proof of the theorem is based on FTC (Fundamental Theorem of Calculus) and MVT from differential calculus. Note that the result holds for any $c \in [a, b]$ if $g(x) = 0$ for all $x \in [a, b]$. Hence let $g$ be non-zero for some point of interval $[a, b]$ and then it follows from continuity that $g$ is non zero on a sub-interval of $[a, b]$. Let's take $g(x) \geq 0$ and then it follows that $\int_{a}^{b}g(x)\,dx > 0$.
We now use Cauchy's Mean Value Theorem from differential calculus. Let $$F(x) = \int_{a}^{x}f(t)g(t)\,dt, G(x) = \int_{a}^{x}g(t)\,dt$$ Then both $F, G$ satisfy all the conditions of Cauchy's MVT and therefore there is a $c \in (a, b)$ such that $$\frac{F(b) - F(a)}{G(b) - G(a)} = \frac{F'(c)}{G'(c)} = \frac{f(c)g(c)}{g(c)} = f(c)$$ (via FTC) and then we get $$\int_{a}^{b}f(t)g(t)\,dt = f(c)\int_{a}^{b}g(t)\,dt$$
