Lemma 37.79.1. A morphism $f : X \to Y$ of affine schemes 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 two triangles commute.

Proof. Let the morphism $f$ be given by the ring map $\phi : R \to S$. Then $f$ is a closed immersion if and only if $\phi$ is surjective.

First, we assume that $\phi$ is surjective. Let $\psi : A \to B$ be an injective ring map, and suppose we are given a commutative diagram

$\xymatrix{ R \ar[r]^\alpha \ar[d]^\phi & A \ar[d]^\psi \\ S \ar[r]^\beta \ar@{..>}[ur] & B }$

Then we define a lift $S \to A$ by $s \mapsto \alpha (r)$, where $r \in R$ is such that $\phi (r) = s$. This is well-defined because $\psi$ is injective and the square commutes. Since taking the ring spectrum defines an anti-equivalence between commutative rings and affine schemes, the desired lifting property for $f$ holds.

Next, we assume that $\phi$ has lifts against all injective ring maps $\psi : A \to B$. Note that $\phi (R)$ is a subring of $S$, so we obtain a commutative square

$\xymatrix{ R \ar[r] \ar[d]^\phi & \phi (R) \ar[d] \\ S \ar@{=}[r] \ar@{..>}[ur] & S }$

in which a lift $S \to \phi (R)$ exists. Hence, the inclusion $\phi (R) \to S$ must be an isomorphism, which shows that $\phi$ is surjective, and we win. $\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).