# Flatness and regular sequences

In Eisenbud's Commutative Algebra, Exercise 18.18 is the following fact from a paper of Hartshorne's:

Suppose $(R,P)$ is a local ring containing a field $k$, and let $x_1,...,x_r\in P$ be a sequence of elements. If $x_1,...,x_r$ is a regular sequence, then $R$ is flat as a module over the polynomial ring $k[x_1,...,x_r]$.

My question is: Does this also hold for different situations, i.e. if $R$ is not assumed to be local? A comment in Exercise 6.7 of [Eisenbud] suggests that it does, but unfortunately no reference is provided. I would be particularly interested in the case where $R$ is itself a polynomial ring.

Any help would be appreciated!

If $M$ is a flat $k[x_1,x_2, x_3]$-module then any permutation of the sequence $x_1, x_2, x_3$ will be regular on $M$, since it is regular on $k[x_1, x_2, x_3]$. Now take $R= k[x,y,z]$ and make it into a $k[x_1,x_2, x_3]$-module by mapping $x_1, x_2, x_3$ to $x-1, xy, xz$,respectively, then $x_1, x_2, x_3$ is $R$-regular, but $x_2, x_3, x_1$ is not. Hence $R$ is not flat over $k[x_1,x_2,x_3]$.
This is what I would try to do in your situation: Let $A$ be the polynomial ring and let $R$ be the other polynomial ring, so that you have a map $A\rightarrow R$, then you can test flatness by looking at localizations $A_{\mathfrak p}\rightarrow R_{\mathfrak q}$, see Lemma 10.38.19 parts (6) and (7) in https://stacks.math.columbia.edu/tag/00H9. Since $R$ and $A$ are regular, the localizations are regular and then you can test flatness by computing the dimension of the fibres (Matsumura Thm 23.1).