Prove if $f$ is continuous and $X$ is compact, then $f(X)$ is bounded. Prove if $f$ is continuous and $X$ is compact, then $f(X)$ is bounded.
That's what I wrote: 
Suppose $f$ is not bounded. Then, $f^{-1}([k,\infty])$ is nonempty, where $[k,\infty)$ is a closed set. Otherwise, $k$ would be an upper bound. Thus, $\cap_{k=0}^{\infty}f^{-1}([k,\infty))$ is nonempty closed-chain-compact since $f$ is continuous and $[k,\infty)$ is closed.
I want have a contradiction here but I cannot see it. Anyone can help me with it? Thanks.
 A: This proof works for any compact topological space $X$ and continuous $f:X\to\mathbb{R}$.
Consider the sets $U_n=(-n,n)\subset \mathbb{R}$ for all $n\in\mathbb{N}_{>0}$. These sets are all open and cover $\mathbb{R}$ therefore the collection $\{f^{-1}(U_n)|n\in\mathbb{N}_{>0}\}$ is an open cover of $X$. Since $X$ is compact this cover must have a finite subcover. 
Let $m$ be the maximum integer such that $f^{-1}(U_m)$ is in this finite subcover. Since $U_i\subset U_j$ for $i< j$ it follows all other elements of the subcover are actually subsets of $f^{-1}(U_m)$. But since the whole of $X$ is covered it follows that $f^{-1}(U_m)=X$. Therefore $f(X)\subseteq U_m$ and hence $f$ is bounded.
A: Here is a different method, but you have to assume $X$ is a metric space: I am assuming $f\colon X \rightarrow \mathbb{R}$. Try taking a sequence in $f(X)$ that goes off to infinity, so $f(x_{n})\rightarrow \infty$. We know the sequence $(x_{n})$ will be in $X$, so will have a convergent sub-sequence, also call this $(x_{n})$. But since $f$ is continuous, $f(x_{n})\rightarrow f(x)\in \mathbb{R}$, which is a contradiction since we assumed $f(x_{n})$ diverged. 
A: Since $f$ is continuous the image of a compact set under $f$ is compact. A compact set in $\mathbb R$ (or any $\mathbb R^n$ for that matter) is closed and bounded (see Heine-Borel theorem). Hence $f(X)$ is bounded.
