$K\subset Y\subset X$ Here is a theorem in Rudin's Principles of Mathematical Analysis: 

$K\subset Y\subset X$.Then $K$ is compact relative to $X$ if and only
  if $K$ is relative to $Y$.

I read the proof in the book but I tried to construct a different proof:Here it is:
"Proof": If $K$ is compact relative to $Y$ and $K\subset Y\subset X$,there exists a finite collection of subsets of $\{Y_{\alpha_i}\}$ of $Y$ such that $$K\subset \cup^{n}_{i=1}\{Y_{\alpha_i}\} $$.As $Y\subset X$,$\exists \{Y_{\alpha_{n+1}}\}\subset X$ such that $X= \cup^{n+1}_{i=1}\{Y_{\alpha_i}\}$,and so $K\subset \cup^{n+1}_{i=1}\{Y_{\alpha_i}\}=X$ which forms an open cover of $K$ ,so $K$ is compact relative to $X$.
Again, if $K\subset Y\subset X$ and $K$ is compact relative to $X$, then let $\cup^{n}_{i=1}\{X_{\alpha_i}\}=X$ be the open cover relative to $K$.As $Y\subset X$ $\exists X_{a_j}$ where $1\leq j\leq n$ such that $$Y=X-\{X_{a_j}\}$$.As $K\subset Y$,$K$ is compact relative to $Y$.
I feel the proof is erroneous but I cannot find the mistake. Thank you. 
 A: Note that $K$ being compact relative to $Z$ means that given any family $\mathcal{U}$ of open (relative to $Z$) sets which covers $K$ (i.e., $K \subset \bigcup \mathcal{U}$), there is a finite subfamily $\{ U_1 , \ldots , U_n \} \subset \mathcal{U}$ such that $K \subset \bigcup_{i=1}^n U_i$.
You cannot just begin with a finite cover of $K$ by open (relative to $Z$) sets because as long as $K \subset Z$ there is always such a cover (regardles s of whether $K$ is in fact compact relative to $Z$): $Z$ is open relative to itself, and so $\{ Z \}$ is a cover of $K$ by open relative to $Z$ sets.
The proof of each direction should begin with something like "Let $\mathcal{U}$ be a family of open sets relative to [the set you are trying to demonstrate compactness with respect to] such that $K \subset \bigcup \mathcal{U}$."  The goal is to find a finite subfamily of $\mathcal{U}$ which still covers $K$.
A: When we say $Y$ is compact relative to $X,$ this means that any collection of open sets in $X$ whose union contains $Y$ (an open cover) can be restricted to a finite collection whose union still contains $Y$ (the finite subcover.) It's important to bear in mind that this is quantifying over all open covers of $Y$ relative to $X.$ In your proof, you haven't mentioned that your finite subcovers are restricted from arbitrary open covers.
Second, it is important to note that openness is a relative condition. For instance, $(0,1)$ is open in $\mathbb{R}$ but not in $\mathbb{R}^2.$ In your notation, we don't necessarily know that the $Y_{\alpha }$ are open in $X.$ The proper way to handle this side of the implication is to start with an open cover of $K$ rekative to $X,$ transform it to an open cover of $K$ relative to $Y$ (by intersecting each of its members with $Y$), restrict to a finite subcover, and pull back to the cover that is open relative to $X.$ 
