# Function that maps compact interval to compact interval has maximum, minimum and IVP

Let $f(x)$ be a function defined for all $x$ that maps compact intervals to compact intervals: $I$ $compact$ $interval$ $\Rightarrow$ $f(I)$ $compact$ $interval$. Do not assume $f(x)$ is continuous.

(a) Prove that on any compact interval $I$ the function attains its maximum and minimum.

(b) Prove that $f(x)$ has the Intermediate Value Property.

Possible derivative of question here: Prove that the image of a a closed and bounded interval in $\mathbb{R}$ is a a closed and bounded interval in $\mathbb{R}$?

Except I can't assume that $f(x)$ is continuous. I know that I will have to use the Continuous Mapping Theorem since these two properties make up the theorem, but the intuition is pretty backwards to me.

Any help is appreciated! Thank you.

Hint for a, Recall compact sets in $\mathbb{R}$ are closed and bounded.
For b, if $f(x)<f(y)$ both $f(x)$ and $f(y)$ live in an interval defined by $f(I)$, it is immediate that there is some value in $f(I)$ between them, call it, $f(z)$, as intervals are connected.
a) Anyway, $f(I)$ is closed and bounded, so $M:=\sup f(I)$ and $m:=\inf f(I)$ both exist and $M,m\in f(I)$.