[IV Corollary 18.12.13, EGA]

Lemma 37.38.3 (Zariski's Main Theorem). Let $f : X \to S$ be a morphism of schemes. Assume $f$ is quasi-finite and separated and assume that $S$ is quasi-compact and quasi-separated. Then there exists a factorization

\[ \xymatrix{ X \ar[rd]_ f \ar[rr]_ j & & T \ar[ld]^\pi \\ & S & } \]

where $j$ is a quasi-compact open immersion and $\pi $ is finite.

**Proof.**
Let $X \to S' \to S$ be as in the conclusion of Lemma 37.38.2. By Properties, Lemma 28.22.13 we can write $\nu _*\mathcal{O}_{S'} = \mathop{\mathrm{colim}}\nolimits _{i \in I} \mathcal{A}_ i$ as a directed colimit of finite quasi-coherent $\mathcal{O}_ X$-algebras $\mathcal{A}_ i \subset \nu _*\mathcal{O}_{S'}$. Then $\pi _ i : T_ i = \underline{\mathop{\mathrm{Spec}}}_ S(\mathcal{A}_ i) \to S$ is a finite morphism for each $i$. Note that the transition morphisms $T_{i'} \to T_ i$ are affine and that $S' = \mathop{\mathrm{lim}}\nolimits T_ i$.

By Limits, Lemma 32.4.11 there exists an $i$ and a quasi-compact open $U_ i \subset T_ i$ whose inverse image in $S'$ equals $f'(X)$. For $i' \geq i$ let $U_{i'}$ be the inverse image of $U_ i$ in $T_{i'}$. Then $X \cong f'(X) = \mathop{\mathrm{lim}}\nolimits _{i' \geq i} U_{i'}$, see Limits, Lemma 32.2.2. By Limits, Lemma 32.4.16 we see that $X \to U_{i'}$ is a closed immersion for some $i' \geq i$. (In fact $X \cong U_{i'}$ for sufficiently large $i'$ but we don't need this.) Hence $X \to T_{i'}$ is an immersion. By Morphisms, Lemma 29.3.2 we can factor this as $X \to T \to T_{i'}$ where the first arrow is an open immersion and the second a closed immersion. Thus we win.
$\square$

## Comments (2)

Comment #2685 by Johan on

Comment #2707 by Takumi Murayama on

There are also: