Let $R$ be a ring (commutative noetherian with unit), and let $K(R)$ be its total ring of fractions (obtained by inverting all nonzerodivisors). Thus, $R \hookrightarrow K(R)$. Let $a \in K(R)$ be integral over $R$; in other words, $R[a]$ is a subring of $K(R)$ that is finite over $R$. 


Is it necessarily true that $R[a]$ is flat over $R$? More to the point, since I'm expecting a negative answer: what is a concrete counterexample?



Subtle examples of morphisms that are finite but not flat
Charles, in your [answer](https://mathoverflow.net/a/85692) you're basically discovering the fact that the normalization is not flat (*answer edited to show that it actually **does** provide an answer to the original question*)


Let $X$ be a non-normal reduced scheme and $\sigma:\widetilde X\to X$ its normalization. Now let $\pi:\widehat X\to X$ be any finite locally projective non-isomorphism that $\sigma$ factors through, i.e., there exists a $\mu:\widetilde X\to\widehat X$ such that $\sigma=\pi\circ \mu$. Then $\pi$ is *not flat*.
Your example is a special case of this: If $R$ and $a$ are as in your question, and we set
$X=\operatorname{Spec}R$, then $\pi:\widehat X=\operatorname{Spec} R[a]\to X$ satisfies the above conditions, hence $\pi$ is not flat.


And here is a proof of the statement: Since $\sigma$ is generically an isomorphism, the same is true for $\pi$ and hence this general fiber is a reduced closed point, so its Hilbert polynomial is $1$.
At the same time the fiber over a (non-normal) point where $\pi$ is not an isomorphism is either not reduced or is reducible and hence its Hilbert polynomial is different than $1$, so $\pi$ cannot be flat. $\square$




---


*Remark*  

Perhaps a more interesting question is to ask for a finite non-flat morphism whose target is smooth. Obviously it will not come from an integral element of the fraction field of the target. Also, the dimension of the players have to be at least $2$, since if the target of a morphism that is dominant on all irreducible components is a smooth curve, then the morphism is automatically flat.


My favorite example of such a morphism is to take two copies of $\mathbb A^d$, $d\geq 2$, intersecting in a single point and mapping them to $\mathbb A^d$ in the obvious way. The target is smooth, the morphism is finite, it is étale outside a single point, but it is not flat. You can try to prove this directly or to use the fact that a finite morphism whose target is smooth is flat if and only if the source of the morphism is Cohen–Macaulay. It is really easy to see that two copies of $\mathbb A^d$, $d\geq 2$, intersecting in a single point is not Cohen–Macaulay.


*Addendum* (to respond to Charles's questions in the [comment](https://mathoverflow.net/questions/85685/subtle-examples-of-morphisms-that-are-finite-but-not-flat#comment220693_85713) below)  

1) The iff statement above follows from the more general Theorem 18.16(b) on page 465 of Eisenbud's CA with a view toward AG.  

2) To see that the example given is not even $S\_2$ observe the following: take one regular function on each of the copies of $\mathbb A^d$ such that their values *do not* agree at the point of intersection. Together they give a regular function on the complement of the point which does not extend to the point. Since the dimension is at least $2$ this implies that the Hartogs condition fails and hence this object is not normal. Since it is obviously $R\_1$ (again also since its dimension is at least $2$), being normal is equivalent to being $S\_2$, so it is not $S\_2$ and (again since its dimension is at least $2$), it is therefore not CM. You can see that for curves this would not be a problem.


I can imagine that one may find this more complicated than computing a regular sequence, but once you work with the condition $S\_2$ a little this seems an obvious observation.
For the connection between $S\_2$ and Hartogs' condition see [this](https://mathoverflow.net/questions/45347/why-does-the-s2-property-of-a-ring-correspond-to-the-hartogs-phenomenon/45354#45354) and [this](https://mathoverflow.net/questions/45347/why-does-the-s2-property-of-a-ring-correspond-to-the-hartogs-phenomenon/45616#45616) answers to [Why does the (S2) property of a ring correspond to the Hartogs phenomenon?](https://mathoverflow.net/questions/45347/why-does-the-s2-property-of-a-ring-correspond-to-the-hartogs-phenomenon). I should also add that the part about being normal is absolutely unnecessary as the point about Hartogs' theorem is the fact that normal implies $S\_2$, so the argument is really just the following:


2') The failure of the Hartogs condition implies that the example is not $S\_2$ and hence not CM.


The reason I argued by normality was that I imagined that people might associate this condition with being normal rather than being $S\_2$. I may have made it too complicated in the process. :)


