Lemma 37.81.4. Let $f: X \to Y$ be a quasi-compact morphism of schemes. Then $f$ is a closed immersion if and only if for every injective ring map $A \to B$ and commutative square

$\xymatrix{ \mathop{\mathrm{Spec}}(B) \ar[d] \ar[r] & X \ar[d]^ f \\ \mathop{\mathrm{Spec}}(A) \ar[r] \ar@{..>}[ur] & Y }$

there exists a lift $\mathop{\mathrm{Spec}}A \to X$ making the diagram commute.

Proof. Assume that $f$ is a closed immersion. Let $A \to B$ be an injective ring map and consider a commutative square

$\xymatrix{ \mathop{\mathrm{Spec}}(B) \ar[d] \ar[r] & X \ar[d]^ f \\ \mathop{\mathrm{Spec}}(A) \ar[r] \ar@{..>}[ur] & Y }$

Then $\mathop{\mathrm{Spec}}(A) \times _ Y X \to \mathop{\mathrm{Spec}}(A)$ is a closed immersion and hence we get an ideal $I \subset A$ and a commutative diagram

$\xymatrix{ \mathop{\mathrm{Spec}}(B) \ar[d] \ar[r] & \mathop{\mathrm{Spec}}(A/I) \ar[r] \ar[d] & X \ar[d]^ f \\ \mathop{\mathrm{Spec}}(A) \ar[r] \ar@{..>}[ur] & \mathop{\mathrm{Spec}}(A) \ar[r] & Y }$

We obtain a lift by Lemma 37.81.1.

Assume that $f$ has the lifting property stated in the lemma. To prove that $f$ is a closed immersion is local on $Y$, hence we may and do assume $Y$ is affine. In particular, $Y$ is quasi-compact and therefore $X$ is quasi-compact. Hence there exists a finite affine open covering $X = U_1 \cup \ldots \cup U_ n$. The source of the morphism

$\pi : U = \coprod U_ i \longrightarrow X$

is affine and the induced ring map $\Gamma (X, \mathcal{O}_ X) \to \Gamma (U, \mathcal{O}_ U)$ is injective. By assumption, there exists a lift in the diagram

$\xymatrix{ U \ar[r]^\pi \ar[d] & X \ar[d]^ f \\ \mathop{\mathrm{Spec}}(\Gamma (X, \mathcal{O}_ X)) \ar[r]^-{f'} \ar@{..>}[ur]^ h & Y }$

where $f'$ is the morphism of affine schemes corresponding to the ring map $\Gamma (Y, \mathcal{O}_ Y) \to \Gamma (X, \mathcal{O}_ X)$. It follows from the fact that $\pi$ is an epimorphism that the morphism $h$ is a retraction of the canonical morphism $X \to \mathop{\mathrm{Spec}}(\Gamma (X, \mathcal{O}_ X))$; details omitted. Hence $X$ is affine by Lemma 37.81.2. By Lemma 37.81.1 we conclude that $f$ is a closed immersion. $\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).