Proposition 29.27.1 (Generic flatness). Let $f : X \to S$ be a morphism of schemes. Let $\mathcal{F}$ be a quasi-coherent sheaf of $\mathcal{O}_ X$-modules. Assume

1. $S$ is integral,

2. $f$ is of finite type, and

3. $\mathcal{F}$ is a finite type $\mathcal{O}_ X$-module.

Then there exists an open dense subscheme $U \subset S$ such that $X_ U \to U$ is flat and of finite presentation and such that $\mathcal{F}|_{X_ U}$ is flat over $U$ and of finite presentation over $\mathcal{O}_{X_ U}$.

Proof. As $S$ is integral it is irreducible (see Properties, Lemma 28.3.4) and any nonempty open is dense. Hence we may replace $S$ by an affine open of $S$ and assume that $S = \mathop{\mathrm{Spec}}(A)$ is affine. As $S$ is integral we see that $A$ is a domain. As $f$ is of finite type, it is quasi-compact, so $X$ is quasi-compact. Hence we can find a finite affine open cover $X = \bigcup _{i = 1, \ldots , n} X_ i$. Write $X_ i = \mathop{\mathrm{Spec}}(B_ i)$. Then $B_ i$ is a finite type $A$-algebra, see Lemma 29.15.2. Moreover there are finite type $B_ i$-modules $M_ i$ such that $\mathcal{F}|_{X_ i}$ is the quasi-coherent sheaf associated to the $B_ i$-module $M_ i$, see Properties, Lemma 28.16.1. Next, for each pair of indices $i, j$ choose an ideal $I_{ij} \subset B_ i$ such that $X_ i \setminus X_ i \cap X_ j = V(I_{ij})$ inside $X_ i = \mathop{\mathrm{Spec}}(B_ i)$. Set $M_{ij} = B_ i/I_{ij}$ and think of it as a $B_ i$-module. Then $V(I_{ij}) = \text{Supp}(M_{ij})$ and $M_{ij}$ is a finite $B_ i$-module.

At this point we apply Algebra, Lemma 10.118.3 the pairs $(A \to B_ i, M_{ij})$ and to the pairs $(A \to B_ i, M_ i)$. Thus we obtain nonzero $f_{ij}, f_ i \in A$ such that (a) $A_{f_{ij}} \to B_{i, f_{ij}}$ is flat and of finite presentation and $M_{ij, f_{ij}}$ is flat over $A_{f_{ij}}$ and of finite presentation over $B_{i, f_{ij}}$, and (b) $B_{i, f_ i}$ is flat and of finite presentation over $A_ f$ and $M_{i, f_ i}$ is flat and of finite presentation over $B_{i, f_ i}$. Set $f = (\prod f_ i) (\prod f_{ij})$. We claim that taking $U = D(f)$ works.

To prove our claim we may replace $A$ by $A_ f$, i.e., perform the base change by $U = \mathop{\mathrm{Spec}}(A_ f) \to S$. After this base change we see that each of $A \to B_ i$ is flat and of finite presentation and that $M_ i$, $M_{ij}$ are flat over $A$ and of finite presentation over $B_ i$. This already proves that $X \to S$ is quasi-compact, locally of finite presentation, flat, and that $\mathcal{F}$ is flat over $S$ and of finite presentation over $\mathcal{O}_ X$, see Lemma 29.21.2 and Properties, Lemma 28.16.2. Since $M_{ij}$ is of finite presentation over $B_ i$ we see that $X_ i \cap X_ j = X_ i \setminus \text{Supp}(M_{ij})$ is a quasi-compact open of $X_ i$, see Algebra, Lemma 10.40.8. Hence we see that $X \to S$ is quasi-separated by Schemes, Lemma 26.21.6. This proves the proposition. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).