Theorem A subset of
Euclidean space Rn is compact if and only if it is closed and bounded.
The proof of this requires a few elementary results on compactness which can be found here.
Lemma The interval [0,1] in R is compact.
Remark Some people call this lemma the Heine-Borel theorem and consider the result above to be a corollary - textbooks seem to vary.
Proof Let A be an open cover of [0,1].
Completeness of R says that every nonempty set that is bounded above has a supremum, a least upper bound. Let K = {x in [0,1] : [0,x] can be covered by finitely many elements of A}. Then K is nonempty, since 0 is in K, and K is bounded above, being a subset of [0,1]. Hence, K has a supremum; call this c. Then [0,c] is covered by some finite subset B of A.
Now c is in K. For A is an open cover of [0,1], so there is some U in A such that U contains c. U is open, so for some real e>0, the interval (c-e, c+e) is contained in U. But c is the supremum of K, so the interval (c-e, c+e) must contain some point y of K. Then [0,y] can be covered by finitely many elements from A, and so by adding the element U, we see that [0,c] can be covered by finitely many elements of A. So c is in K.
We now suppose c<1 and derive a contradiction. Since A is an open cover, there is an open set U in A which contains c. Since U is open, it contains some small open interval (c-d, c+d) about c, where d>0. In particular, U contains c+(d/2). Then B union {U} is finite, and is an open cover not just of [0,c] but of [0,c+(d/2)], and so c+(d/2) lies in K, and so this contradicts the fact that c is an upper bound for K.
So we can't have c<1, and c is in [0,1], so this gives c=1. Then [0,1] can be covered by finitely many elements of A, and so [0,1] is compact.
Theorem A subset of Rn is compact if and only if it is closed and bounded.
Proof Let C be a compact subset of Rn. Since Rn is a metric space, and so is Hausdorff, it follows from standard results on compactness that C is closed and bounded.
Now suppose C is a closed, bounded subset of Rn. Then there is some M>0 such that d(x,0)<M whenever x is in C, where d is the standard Euclidean metric. Define f:[0,1]->R by f(y) = 2My - M. Then f is continuous, and maps [0,1] onto [-M,M], so [-M,M] is compact. Then the finite product [-M,M]n is compact, and includes C as a closed subset; hence C is compact.