This question on math.stackexchange caught my eye and I thought I would reproduce the nice argument given by David Speyer, possibly with more background explained.
The question is as follows: is the variety of matrices of rank exactly k an affine variety?
Those of rank at most k is an affine variety since they are defined by the vanishing of all minors of size k. This also shows that the rank k matrices form a quasi-affine variety. In fact, those of rank exactly n form an affine variety since this is the solution set of the equation where t is a newly introduced indeterminant. However, this argument doesn’t work for smaller values of k, and we will see they cannot be written as the solution set of a system of equations, regardless of how many new indeterminants are introduced.
This follows from a more general theorem.
Theorem. Let X be an affine variety (or more generally, a Noetherian affine scheme) and let Y be a closed subvariety with an irreducible component of codimension >1. Then the complement of Y is not affine.
To apply this, we first note that the matrices of rank at most k have codimension in the space of all matrices and set X to the matrices of rank at most k, and Y to be the matrices of rank at most k-1. When k<n, we see that Y has codimension at least 2 in X.
To prove the theorem, we use the following cohomological characterization of affine varieties due to Serre:
Theorem (Serre). Let X be a variety (or more generally, a Noetherian scheme). Then the following are equivalent:
- X is affine
- For all quasi-coherent sheaves F and all i>0, one has .
- For all coherent sheaves of ideals I, one has .
We won’t need the third condition though. The next ingredient is cohomology with supports / local cohomology. Given any topological space X with an open subset U, let Y be the complement of U. For a sheaf F of Abelian groups on X, we define the group of sections of F with support in Y to be those sections s of F such that for each point P of Y, s is not identically 0 on any open neighborhood of P. Denote it by . This is left exact, so we get derived functors. In particular, there is a long exact sequence of the form
Now suppose that X is an affine scheme of the form Spec(R), Y is the subvariety cut out by an ideal I, and F is a quasi-coherent sheaf corresponding to an R-module M. There is an alternative description of in terms of local cohomology. I wrote a little bit about local cohomology before, but let me define it again. We define
This is left-exact and its derived functors agree with what we just defined:
Furthermore, these groups only depend on the radical of I, and not I itself. In the case when R is local and I is the maximal ideal of R, Grothendieck’s nonvanishing theorem says that
where . In particular, since local cohomology behaves well with respect to localization, one can say that
for an ideal I and arbitrary ring and where the subscript denotes localization at a prime P which is minimal over I.
Now let’s put it all together. Take F to be the structure sheaf of X. Suppose that Y has an irreducible component of codimension > 1. Since X is affine, we have for all i>0 by Serre’s theorem. Then the long exact sequence above implies that
where the last part is Grothendieck’s nonvanishing theorem. But r-1>0, so Serre’s theorem implies that U is not affine. QED
One possible reference is: “Twenty-four hours of local cohomology” by Iyengar, Leuschke, Leykin, Miller, Miller, Singh, Walther.