# Generalization of the statement that $\mathbb{A}^2\setminus (0,0)$ is not affine?

$\mathbb{A}^2\setminus (0,0)$ is often given as an example of a variety that is not affine. I am trying to understand this example better by seeing it as a special case of a natural general claim.

Claim: Let $X$ be an affine variety over an algebraically closed field $k$ such that $k[X]$ is a UFD. Let $Y$ be any closed subset of codimension at least 2. Then $X\setminus Y$ is not affine.

Is this the right general claim?

If so, can I drop the assumption that $k$ is algebraically closed, or is that needed?

• If you drop the assumption that $k$ is algebraically closed, then you have to be more clear about what you mean by "affine variety", what you mean by morphism, etc. – Zhen Lin Feb 14 '14 at 17:04
• You would probably be better off doing this in terms of schemes if you want to get rid of $k$ being algebraically closed. – Tobias Kildetoft Feb 14 '14 at 18:12
• @ZhenLin - good point. – Ben Blum-Smith Feb 16 '14 at 23:43

Let $X$ be an integral affine, Notherian normal scheme, and $F$ a (EDIT: Non-empty--thanks Cantlog) closed subset with $\text{codim}_X(F)\geqslant 2$. Then, $X-F$ is a non-affine open subscheme.
Indeed, using "Algebraic Hartog's Lemma" one can show that the inclusion $(X-F)\hookrightarrow X$ induces an isomorphism $\mathcal{O}_X(X)\to\mathcal\to\mathcal{O}_{X}(X-F)$. If $X-F$ were affine, this would contradict the equivalence of categories $\mathsf{Sch}^{\text{op}}\xrightarrow{\approx}\mathsf{Ring}$.
• One must suppose $F$ is non-empty. The statement is true without assuming $X$ is affine. – Cantlog Feb 14 '14 at 21:42
• This is because I often forget to check with such a special case myself :). The general case is an easy consequence of the affine case, just consider the codimension at the generic points of $F$. – Cantlog Feb 15 '14 at 18:40