# Basic calculus question

Let $f$ be a bounded continuous function on $[a,b]$. Prove $f$ attains its max and min on $[a,b]$; there exists $x_0$, $y_0 \in [a,b]$ such that $f(x_0) \leq f(x) \leq f(y_0)$ for all $x \in [a,b]$.

Proof: I already got the part of the maximum. In other words that $f$ attains its max at $M = sup\{f(x)\}$. To show that $f$ attains its min, Can I just say that since $-f$ attains its maximum at $sup\{-f\}$, then since $sup(-S) = -inf(S)$, $f$ attains min at $inf\{f\}$ ?

Is this correct? Do you guys have better ideas?

thanks

-
Yes; if you already have the maximum, then you can reverse the argument as you have done. – Christopher A. Wong Oct 22 '12 at 5:41

I think this way is easier: Since $f$ is continuous, then $-f$ is also continuous, and hence it attains its max at $-f(x_0)$. In other words, $-f(x) \leq -f(x_0)$, and this implies $f(x) \geq f(x_0)$, and therefore $f$ attains its minimum at $f(x_0)$.