Closed subsets of compact sets are compact

If S is a compact subset of R and T is a closed subset of S,then T is compact.
(1) Prove this using the definition of compactness.

Can somebody prove it? I think we should select a open cover of S randomly, and then we should think about the set S-T. Is S-T open in R? I don’t know how to continue?

Solutions Collecting From Web of "Closed subsets of compact sets are compact"

Consider any open cover $G_{\lambda}$ of $T$. Then if $S \subseteq G_{\lambda}$ too there is a finite covering of $S$ using sets from $G_{\lambda}$ which also contains $T$ and hence is a finite covering of $T$. Suppose $S \not \subseteq G_{\lambda}$. Then consider $ G_{\lambda} \cup T^C $ which is an open covering of $S$ since $T$ is closed and $T^C$ is an open set. Then again since $S$ is compact we have that there is a finite covering of $S$ using sets in $G_{\lambda} \cup T^C $. Removing $T^C$ if it was part of this finite covering we have a finite covering of $T$. Hence $T$ is compact.