Let $R \subseteq S$ be two commutative $\mathbb{C}$-algebras such that:


**(1)** $R$ and $S$ are integral domains.


**(2)** $Q(R)=Q(S)$, namely, their fields of fractions are equal.


**(3)** $S=R[w]$, for some $w \in S$.


**(4)** $S$ is [separable](https://en.wikipedia.org/wiki/Separable_algebra) over $R$, namely, $S$ is a projective $S \otimes\_R S$-module via $f: S \otimes\_R S 
\to S$ given by: $f(s\_1 \otimes\_R s\_2)=s\_1s\_2$.



> 
> Should such $S$ be flat over $R$? I guess no, so please it would be nice to see a counterexample.
> 
> 
> 



> 
> Is there a fifth condition that would guarantee flatness of $R \subseteq S$?
> 
> 
> 


Perhaps adding a fifth condition **(5)** $R$ is a UFD (or at least integrally closed) would guarantee
flatness of $R \subseteq S$? (I am not sure).


The above is (almost) question 3 of [this](https://mathoverflow.net/questions/371948/separability-of-mathbbcx-over-its-mathbbc-subalgebras) question.
Also asked [here](https://math.stackexchange.com/questions/3830436/example-of-non-flat-r-subseteq-rw) without comments.


Thank you very much!



Separable non-flat simple ring extension
Take $R$ to be the coordinate ring of the nodal curve $\mathbb{C}[t^2-1, t(t^2-1)]$ and $S$ to be its normalization $\mathbb{C}[t]$. It satisfies (1), ..., (4): The first three are immediate. For (4), note that since $R$ is noetherian, the projectivity of $S$ as an $S \otimes\_R S$-module is equivalent to $S$ being unramified over $R$ (Theorem 2.5 in Auslander-Buchsbaum, *On Ramification Theory in Noetherian Rings*, American Journal of Mathematics, 1959). It is enough to check that maximal ideals are unramified. Since we are in equi-characteristic zero, it suffices to show that for every maximal ideal $\mathfrak{q}$ of $S$, $(\mathfrak{q} \cap R) S\_{\mathfrak{q}} = \mathfrak{q} S\_{\mathfrak{q}}$. Let $\mathfrak{q} = (t-\alpha)$, $\alpha \in \mathbb{C}$.
Then $(\mathfrak{q} \cap R) S = 
(t^2 - \alpha^2, t(t^2-1)- \alpha(\alpha^2-1))$.
If $\alpha \neq 0$, then $t+\alpha \not \in \mathfrak{q}$
so $t-\alpha \in (\mathfrak{q} \cap R)S\_{\mathfrak{q}}$.
If $\alpha = 0$, then $t^2-1 \not \in \mathfrak{q}$
so $t \in (\mathfrak{q} \cap R)S\_{\mathfrak{q}}$.
Either way, $(\mathfrak{q} \cap R)S\_{\mathfrak{q}} = 
\mathfrak{q}S\_{\mathfrak{q}}$. However, $S$ is not a flat $R$-module.


Further comments:


1. If $R$ is noetherian and $R \rightarrow S$ is a finite (as it is in the
example), then $S$ is $R$-flat if and only if it is $R$-projective; since
$\mathrm{Spec} R$ is connected, for every prime $R$-ideal $\mathfrak{p}$,
the fibre $\dim\_{\kappa(\mathfrak{p})}\kappa(\mathfrak{p}) \otimes\_R S$
does not depend on $\mathfrak{p}$, so $\kappa(\mathfrak{p}) \otimes\_R S =
\kappa(\mathfrak{p})$, since $Q(R) = Q(S)$. Hence for maximal $R$-ideals
$\mathfrak{p}$, the map $R/\mathfrak{p} \to S/\mathfrak{p}S$ is an
isomorphism; by the Nakayama lemma, $S/R = 0$, i.e., $S=R$.
2. If $w = \frac{1}{r}$ for some $r \in R$, then $S$ is flat.
3. If $R$ is integrally closed, but $S$ is not obtained by inverting one
element of $r$, then I don't know an example where $(4)$ holds. For
example, let $R = \mathbb{C}[x,y]$ and $S = \mathbb{C}[x, \frac{y}{x}]$.
This ring map comes from blowing up $\mathbb{C}^2$ at the origin.
Note that $xS$ defines the exceptional divisor in the affine open set of
the blow-up given by $\mathrm{Spec} S$.
If $\mathfrak{q}$ is a maximal $S$-ideal containing $xS$,
then $\mathfrak{q} \cap R = (x,y)R$ and
$(\mathfrak{q} \cap R)S = xS$. Hence $S$ is not unramified over $R$.


