# True /False question about Compact sets and continuous functions [duplicate]

I am trying some assignment questions and I am unable to think on how can I solve this problem.

Question: Let K be subset of $$\mathbb{R^{n} }$$ such that every real valued continuous function on K is bounded. Then is K compact?

I think this statement is true as if it were false then it would be impossible to give a counterexample as it has to be verified for every real valued function ( continuous) .

But I have no clue on how can I prove it.

Please give hint.

## 1 Answer

Hint: $$K$$ is compact if and only if it is closed and bounded. You should devise a continuous function such that if $$K$$ is not bounded, the function is unbounded. Likewise, if $$K$$ is not closed, you can construct a continuous function on $$K$$ which is unbounded.