Closed subset of a variety is also a variety Suppose that $(X,\mathcal{O}_{X})$ is a variety and $Y\subset X$ is closed and equipped with the induced subspace topology. I want to prove that $(Y,\mathcal{O}_{Y})$ is also a variety, where for every open $V\subset Y$ we have $\mathcal{O}_{Y}(V):= \{f:V\rightarrow k\rvert \forall P\in V, \ \exists U\subset X, \ \exists g\in\mathcal{O}_{X}(V) \ \text{s.t} \ P\in U,  \forall Q\in V\cap U \ \text{we have} \ f(Q) = g(Q)\}$.

My Attempt First one has to show that $(Y,\mathcal{O}_{Y})$ is a $k$-space. But this follows easily from the definition above of $\mathcal{O}_{Y}$. So assuming we know that $(Y,\mathcal{O}_{Y})$ is a $k$-space, then we only have to show that for every $y\in Y$ there is an open $V\subset Y$ with $y\in V$ such that $(V,\mathcal{O}_{Y}\rvert_{V})$ is isomorphic (as $k$-spaces) to $(Z,\mathcal{O}_{Z})$ for some closed $Z\subset \mathbb{A}^{n}$ for some $n$. Since we know that $(X,\mathcal{O}_{X})$ is a variety, we know that there exists a cover of $X$, say $X = \cup_{i\in I} U_{i}$ where $U_{i}$ is an open subset of $X$ such that $(U_{i},\mathcal{O}_{X}\rvert_{U_{i}})$ is isomorpic to $(S,\mathcal{O}_{S})$ for some closed $S\subset \mathbb{A}^{m}$ for some $m$. We notice that $Y = \cup_{i\in I} (U_{i}\cap Y)$, where we notice that the $U_{i}\cap Y$ are open in $Y$. My guess would be that for every $i\in I$ we have $(U_{i}\cap Y,\mathcal{O}_{Y}\rvert_{U_{i}\cap Y})$ is isomorphic to some $(Z_{i},\mathcal{O}_{Z_{i}})$ for some closed $Z_{i}\subset \mathbb{A^{n}}$ for some $n$. If so, then we are done. But I have problems with proving this. 

Definition for morphism I use:
Let $(X,\mathcal{O}_{X})$ and $(Y,\mathcal{O}_{Y})$ be $k$-spaces and $\varphi: X\rightarrow Y$. Then $\varphi$ is a morphism of $k$-spaces if $\varphi$ is continuous, and $\forall U\subset Y$ open, and for all $f\in\mathcal{O}_{Y}(U)$, the function $f\circ\varphi : \varphi^{-1}(U)\rightarrow k$ is in $\mathcal{O}_{X}(\varphi^{-1}(U))$.
Hint: a closed subset of a closed subset is again closed.

Bigger hint: 


   Apply this to $U_i\cap Y\subset U_i$ and $U_i\cong S \subset \Bbb A^n$.


Giving the whole game away:


   Since $U_i\cap Y$ is closed in $U_i$ and $U_i$ is isomorphic to a closed subset in $\Bbb A^n$, the image of $U_i\cap Y$ in $S$ under the isomorphism $U_i\cong S\subset \Bbb A^n$ will again be a closed subset of $\Bbb A^n$. The sheaf condition should follow quite quickly.
Hint: a closed subset of a closed subset is again closed.

Bigger hint: 


   Apply this to $U_i\cap Y\subset U_i$ and $U_i\cong S \subset \Bbb A^n$.


Giving the whole game away:


   Since $U_i\cap Y$ is closed in $U_i$ and $U_i$ is isomorphic to a closed subset in $\Bbb A^n$, the image of $U_i\cap Y$ in $S$ under the isomorphism $U_i\cong S\subset \Bbb A^n$ will again be a closed subset of $\Bbb A^n$. The sheaf condition should follow quite quickly.