# How to prove range of function is between $m$ and $M$ [closed]

The question goes like this:

If $$f(x)$$ is a non-constant, continuous function defined on a closed interval $$[a,b]$$ Then by the Extreme Value Theorem, there exist an absolute minimum $$m$$ and an absolute maximum $$M$$.

Based on this, I need to show that the range of $$f$$, $$\{f(x) \mid a \le x \le b\}$$, is the interval $$[m, M]$$.

Consider the Intermediate value theorem, let $$x\in [m,M]$$ and then since there are $$x_1,x_2$$ such that $$f(x_1)=m, f(x_2)=M$$ we get the desired result.
First show that the range is contained in the interval $$[m,M]$$. Then use the Intermediate Value Theorem to show that if $$y \in [m,M]$$ then there exists an $$x \in [a,b]$$ with $$y=f(x)$$.