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.