Definition of compactness in $\mathbb{R}$ Let $A\subseteq K\subseteq\mathbb{R}$ where $K$ is compact.
Since $K$ is compact, then let $\bigcup_{i\in I} U_{i}$ be a cover of $K$ by open subsets of $\mathbb{R}$
$\implies\exists\space r\in\mathbb{N}$ such that $U_{1}\bigcup U_{2}\bigcup$...$\bigcup U_{r}=C$ covers $K$ as well.
But $A\subseteq K$, so $C$ covers $A$ as well. Since the initial cover was chosen arbitrarily, then by definition, $A$ must also be compact.
I know there is something wrong in my reasoning because, in $\mathbb{R}$, I can pick the set $(0,1)\subseteq[-1,2]$ with $(0,1)$ not compact since it is not closed and $[-1,2]$ compact since it is closed and bounded. Can anyone tell me where I'm erring?
 A: Not every open covering of $A$ is an open covering of $K$. In your specific example, for instance, the sets $U_{n}:=(\frac{1}{n},1-\frac{1}{n})$ form an open covering of $(0,1)$ but not of $[-1,2]$.
Your reasoning was incorrect because, you only showed that every open cover of $K$ has a finite subcover which covers $A$.
A: You have chosen an arbitrary open cover $\{U_i\}_{i \in I}$ of $K$  and shown that there exists a finite subcover that covers $A$. This follows immediately since $K$ is compact and there exists a finite subcover for the arbitrary open cover which covers $K$ (and hence also $A$ since $A$ is a subset of $K$) $$A \subseteq K \subseteq \bigcup_{i = 1}^n U_i$$
But what you need to do to show that $A$ is compact is to pick an arbitrary open cover $\{V_i\}_{i \in J}$ of $A$ and show that this open cover contains a finite subcover $\{V_1, ..., V_m\}$ of $A$
The reason why we need to do this is because even though $K$ is compact a subset $A$ of $K$ need not be compact.
And furthermore the open sets of $K$ need not be open sets in $A$, so an open cover of $K$ may not even be an open cover of $A$.
