# Intersection of an open affine with closed = open affine?

Let $X$ be a scheme, $U\subseteq X$ open affine and $Y$ a closed subscheme of $X$. Is it true that $Y\cap U$ is an open affine subscheme of $Y$?

To be more precise, we have an open immersion $U\to X$ and a closed imersion $Y\to X$, so we can form the fiber product $U\times _X Y$ which we call $U\cap Y$ and the induced morphism $U\cap Y\to Y$ is an open immersion as well. Now, with the assumption that $U$ is an affine scheme, we can ask if $U\cap Y$ is an affine scheme. The question is, is it always the case? is it with some additional assumptions? is there a simple provable counterexample?

-
Yes. It's clear that $Y \cap U$ is a closed subscheme of $U=Spec(R)$, which is affine. And a closed subscheme of an affine scheme is affine. That's because it is defined by an $R$-ideal $I$, and so $Y \cap U = Spec(R/I)$. See Chapter II, Corollary 5.10, p 116 of Hartshorne. –  Parsa Feb 16 '12 at 13:25
Yes, $Y\cap U$ is a closed affine subscheme of $U$ and an open affine subscheme of $Y$. No additional assumption is necessary. (By the way, the formulation with fibre products you evoke is not more precise: subschemes and immersions are completely clear and unambiguous concepts) –  Georges Elencwajg Feb 16 '12 at 13:33
If either of you writes this as an answer I would be happy to accept it. –  KotelKanim Feb 16 '12 at 13:44
I suggest that @Parsa should promote his nice comment to an answer. –  Georges Elencwajg Feb 16 '12 at 14:25
At Prof Elencwajg's suggestion, here's an answer. Any closed subscheme of an affine scheme is affine, see Corollary 5.10, p. 116 of Hartshorne. In your question, $U=Spec(R)~~$ is affine and $Y \cap U$ is a closed subscheme of $U$, hence affine.
I'll sketch a proof of this statement. The sheaf of ideals $\mathcal I$ in $\mathcal O_U$ that defines $Y \cap U$ is of the form $\widetilde{I}$ for some $R$-ideal $I$, since there is an equivalence of categories between the category of $R$-modules and the category of quasi-coherent sheaves of $\mathcal O_U$-modules. (See Corollary 5.5, Hartshorne.) It then follows that $Y \cap U = Spec(R/I)$.