# For open affine $U\subset$ affine $X$, why is $k[U]$ flat over $k[X]$?

This is a homework problem for me so please do not post a full solution. I would very much appreciate a hint to move me past the point at which I'm stuck. Here is my work so far:

The setting is that $X$ is an affine algebraic variety over an algebraically closed field $k$ and $U$ is an open affine subvariety. At first I thought that $k[U]$ would necessarily be a localization of $k[X]$ and then it would automatically be flat. Then I learned (e.g. see Hailong Dao's example here) that this doesn't have to be so because a function on $k[U]$ could be locally a quotient of functions in $k[X]$ at every point of $U$ without being a quotient globally on all of $U$.

However, flatness is a very local property, so this shouldn't be a terminal problem. At each point of $U$, $k[U]$ is a localization of $k[X]$. Here's what came out when I tried to make this thought precise: $k[U]$ is flat over $k[X]$ if $k[U]_\mathfrak{m}$ is flat over $k[X]_\mathfrak{m}$ for all maximal ideals $\mathfrak{m}$ of $k[X]$. Now if $\mathfrak{m}$ corresponds to a point $p$ of $X$ that is in $U$, then $k[U]_\mathfrak{m}=k[X]_\mathfrak{m}=\mathcal{O}_{X,p}$. Since any ring is flat over itself, for $\mathfrak{m}$ corresponding to $p\in U$, we have what we need.

This also seems to be the argument given by James Milne in his notes (see p. 146, footnote 1). However, I am unsatisfied. To apply the theorem that flatness is local, I need to localize at every maximal ideal of the base ring, which in this case is $k[X]$. I localized at all $\mathfrak{m}$ corresponding to $p\in U$; but what about the maximal ideals of $k[X]$ corresponding to points outside $U$? Is it obvious that $k[U]_\mathfrak{m}$ is flat over $k[X]_\mathfrak{m}$ in these cases?

I have gotten as far as trying to describe the rings $k[U]_\mathfrak{m}$ and $k[X]_\mathfrak{m}$ to myself in these cases. $k[U]_\mathfrak{m}$ is functions regular on $U$ divided by functions nonzero at $p\notin U$. $k[X]_\mathfrak{m}$ is functions regular on all of $X$ divided by functions nonzero at $p$. This can now be a smaller ring, so it is no longer any more clear to me that $k[U]_\mathfrak{m}$ is flat over $k[X]_\mathfrak{m}$ than it was that $k[U]$ was flat over $k[X]$ in the first place. This is where I'm stuck.

Further thoughts: although I haven't seen so far how to make this local proof work, the basic logic of working locally seems inescapable to me: after all, $k[U]$ consists of quotients of functions from $k[X]$. Shouldn't it be flat for "essentially the same reason" that localizations are flat?

At any rate, a hint to push me past this stuck point would be much appreciated. Thanks in advance.

-
@Andrew - Oops! I meant but forgot to stipulate that $U$ is open. I've edited the post. – Ben Blum-Smith Nov 20 '12 at 22:15

As Andrew said in the comment, I think your $U$ here really means an affine open set.
One thing you may want to know is that in fact, for a ring extension $A \to B$, to check that it is flat it suffices to show the flatness for $A_p \to B_{P}$, where $P$ is any prime ideal (or even better, any maximal ideal) of $B$ and $p$ is the pullback to $A$. (See, eg Matsumura's "Commutative Ring Theory", Theorem 7.1) So in fact you don't need to worry about those points lying outside $U$.
Hmmm, yeah, that does it completely. I looked up the Matsumura reference. The moral of the proof seems to be that because tensoring an $A$-module with $B$ makes it a $B$-module, injectivity of $M\otimes_A B\rightarrow N\otimes_A B$ follows from injectivity at the localizations with respect to maximal ideals of $B$. Thanks. – Ben Blum-Smith Nov 21 '12 at 18:22