MVT for integrals: strict inequality not needed before applying IVT? I've looked at Nigel Overmars's answer here:
https://math.stackexchange.com/a/630429/349828
His proof is essentially identical to the one I wrote myself and to the one given by my analysis professor in class.  However, I'm driven out of an abundance of caution to ask the following question:
Are we really allowed to apply the Intermediate Value Theorem once we have:
$$ m \leq \frac{\int_a^b f(x)g(x)dx}{\int_a^b g(x)dx} \leq M$$
I was under the impression that we need strict inequality for the hypotheses of the IVT to be satisfied, i.e., we need the following:
$$ m \lt \frac{\int_a^b f(x)g(x)dx}{\int_a^b g(x)dx} \lt M$$
Am I crazy?
Edited to add:
Here's the full question I'm trying to answer.  I'm fairly sure I did part (a) without any trouble.  The subtle snag I'm worried about is in part (b), which led to my original question above.
Suppose that $a \lt b$, $f$ and $g$ are continuous real-valued functions on the interval $[a, b]$, and $0 \lt g(x)$ for each $x$ in $[a, b]$.  Prove each of the following:
a.  If $m \leq f(x) \leq M$ on $[a, b]$ for some real numbers $m$ and $M$, then $ m \leq \frac{\int_a^b f(x)g(x)dx}{\int_a^b g(x)dx} \leq M  .$
b.  There exists $c \in (a, b)$ such that $\int_a^b f(x)g(x)dx = f(c)\int_a^b g(x)dx  .$
Does that make my concern any clearer, or am I still crazy?
 A: The relevant function to consider here is
$$ F(c) = \frac{f(c) \int_a^b g(x) dx}{\int_a^b g(x) dx}.$$
Then $F$ is continuous and so it maps the interval $[a,b]$ to the interval $[m, M]$.
What this means is that there is some $c \in [a,b]$ such that
$$ F(c) = \frac{\int_a^b f(x) g(x) dx}{\int_a^b g(x)dx}.$$
This is what the problem you link to asked to show.
It is conceivable that $c = a$ or $c = b$, so one can only guarantee $c \in [a,b]$ instead of $c \in (a,b)$.
A: I believe I have come up with an adequate answer to this question.  Here it is:
$f$ and $g$ are given to be continuous on $[a, b]$, so they are both integrable on $[a, b]$.  Also, $g(x)$ is given to be positive for all $x \in [a, b]$.
Part (a):
Assume that $m \leq f(x) \leq M$ for some $m, M \in \Bbb R$ and for all $x \in [a, b]$.
Remark: the problem gives this to us by assumption, but in fact, we are guaranteed to have such $m$ and $M$ by the Extreme Value Theorem.
Since $g(x) \gt 0$ for all $x \in [a, b]$, we have:
$$mg(x) \leq f(x)g(x) \leq Mg(x) \qquad \text{for all } x \in [a, b]$$
$$\int_a^bmg(x)dx \leq \int_a^bf(x)g(x)dx \leq \int_a^bMg(x)dx$$
$$m\int_a^bg(x)dx \leq \int_a^bf(x)g(x)dx \leq M\int_a^bg(x)dx$$
Since $g(x) \gt 0$ for all $x \in [a, b]$, we know $\int_a^bg(x)dx \gt 0$.  Thus, we have:
$$m \leq \frac{\int_a^bf(x)g(x)dx}{\int_a^bg(x)dx} \leq M$$as desired.  QED.
Part (b):
Let $m = \inf\{f(x)\,\lvert\, x \in [a, b]\}$ and $M = \sup\{f(x)\,\lvert\, x \in [a, b]\}$.
Since $f$ is continuous and $[a, b]$ is compact (by the Heine-Borel Theorem), we are guaranteed by the Extreme Value Theorem that:
(1) $m \in \Bbb R$ and $M \in \Bbb R$
(2) $f(s) = m$ and $f(t) = M$ for some $s, t \in [a, b]$
We must have $m \leq M$, so we will consider two cases: $m = M$ or $m \lt M$.
Case One: Assume that $m = M$.  Then $f$ is a constant function on $[a, b]$.  Hence, for any $c \in (a, b)$ it is trivially true that $\int_a^bf(x)g(x)dx = f(c)\int_a^bg(x)dx$.
Case Two: Assume that $m \lt M$.  Let $I \subseteq \Bbb R$ be the image of $[a, b]$ under $f$, i.e., $I = f([a, b])$.  Since $f$ is continuous and $[a, b]$ is connected, $I$ is connected.  The only connected subsets of $\Bbb R$ are intervals.  Since $m = \inf I$; $M = \sup I$; $m, M \in I$; and $m \neq M$, we must have $I = [m, M]$.
Now, let $J \subseteq \Bbb R$ be the inverse image of $(m, M)$ under $f$, i.e., $J = f^{-1}[(m, M)]$.  By the preceding argument, $J$ is non-empty.  Since $f$ is continuous and $(m, M)$ is open, $J$ is open.  Every non-empty open subset of $\Bbb R$ is a countable union of disjoint open intervals, so this is true of $J$.  Let $K \subseteq J$ be one such open interval.  Then $m \lt f(x) \lt M$ for all $x \in K$.
We now proceed in a manner similar to part (a) above, but with an important variation.
Since $g(x) \gt 0$ for all $x \in [a, b]$, we have:
$$mg(x) \leq f(x)g(x) \leq Mg(x) \qquad \text{for all } x \in [a, b]$$
Now, since $m \lt f(x) \lt M$ for all $x \in K$ and $K \subseteq [a, b]$, we may change to strict inequalities upon integration:
$$\int_a^bmg(x)dx \lt \int_a^bf(x)g(x)dx \lt \int_a^bMg(x)dx$$
$$m\int_a^bg(x)dx \lt \int_a^bf(x)g(x)dx \lt M\int_a^bg(x)dx$$
Since $g(x) \gt 0$ for all $x \in [a, b]$, we know $\int_a^bg(x)dx \gt 0$.  Thus, we have:
$$m \lt \frac{\int_a^bf(x)g(x)dx}{\int_a^bg(x)dx} \lt M$$
$$f(s) \lt \frac{\int_a^bf(x)g(x)dx}{\int_a^bg(x)dx} \lt f(t)$$
Finally, since $f$ is continuous and $[a, b]$ is connected, we are guaranteed by the Intermediate Value Theorem that there is some $c$ between $s$ and $t$ such that:
$$f(c) = \frac{\int_a^bf(x)g(x)dx}{\int_a^bg(x)dx}$$
Therefore, there is indeed a $c \in (a, b)$ such that $\int_a^bf(x)g(x)dx = f(c)\int_a^bg(x)dx$.
In both cases, we were able to supply the desired $c$.  QED.
A: From OP's question and answer it is clear that he is interested in ensuring that $c \in (a, b)$ instead of $c \in [a, b]$ in the statement of mean value theorem for integrals. The result is true but somewhat difficult to establish. A much simpler approach is to use the Cauchy's Mean Value theorem with $$F(x) = \int_{a}^{x}f(t)g(t)\,dt, G(x) = \int_{a}^{x}g(t)\,dt$$ Since $f, g$ are continuous on $[a, b]$ and $g$ is positive, the functions $F, G$ satisfy all the conditions of Cauchy's Mean Value Theorem and therefore $$\frac{F(b) - F(a)}{G(b) - G(a)} = \frac{F'(c)}{G'(c)}$$ for some $c \in (a, b)$. This means that $$\int_{a}^{b}f(x)g(x)\,dx = f(c)\int_{a}^{b}g(x)\,dx$$ for some $c \in (a, b)$.
This is one of the reasons that the mean value theorem for derivatives is a much more powerful result than the mean value theorem for integrals. See this answer also in this regard.
