Theorem (extreme value theorem)

Suppose $f: [a,b]\to\R$ is continuous.

Then there exists $y, Y\in[a,b]$ such that $$ f(y) \leq f(x) \leq f(Y)\quad\forall x\in[a,b]. $$

Proof