# Application of IVT to Proof of MVT for Integrals

I'm trying to understand the proof for the mean value theorem of integrals. I was looking at the following method of proof where after using the extreme value theorem to obtain a maximum and minimum on a closed interval we obtain the following inequality,

$$f\left(m\right)\leq\frac{1}{b-a}\int_{a}^{b}f\left(x\right)dx\leq f\left(M\right)$$ Where $$M:=\max\{f\left(x\right)|x\in[a,b]\}$$

$$m:=\min\{f\left(x\right)|x\in[a,b]\}$$

At this point, the proofs I've seen apply the intermediate value theorem. My question is, to what function are we applying the intermediate value theorem? I.e. Are we arguing that $$g(x)=\frac{1}{b-a}\int_{a}^{b}f\left(x\right)dx$$ will obtain all values between $$f(m)$$ and $$f(M)$$? But how do we know that, as our inequality only states that our function is bounded by these two values.

No.We are not arguing that $$g(x)=\frac{1}{b-a}\int_{a}^{b}f\left(x\right)dx$$, because expression $$\frac{1}{b-a}\int_{a}^{b}f\left(x\right)dx$$ is constant value(doesn't depends on $$x$$), which lies in $$[f(m),f(M)]=R$$.
Since, continuous function $$f$$ takes every value in it's range $$R$$( By IVT), we hace $$f(c)=\frac{1}{b-a}\int_{a}^{b}f\left(x\right)dx$$, for some $$c\in [a,b]$$.