Hey!!

Let $D\subseteq \mathbb{R}$ be a non-empty set. I want to show that $D$ ist compact if and only if each continuous function is bounded on $D$.

I have done the following:

We suppose that $D$ is compact. Since $f$ is continuous, we have that $f(D)$ is also compact, right?

We have that a set is compact iff it is bounded and closed.

Therefore, we have that $f(D)$ is bounded, and so $f$ is bounded on $D$.

Let $f$ be a continuous function that is bounded on $D$.

Since $f$ is bounded on $D$, we have that $f(D)$ is bounded.

To show that $D$ is compact we have to show that $D$ is bounded and closed.

Could you give me a hint how we could show that?