Solution (source code)

= Solution

On an affine open $W=\operatorname{Spec}A\subseteq X$, write $Z\cap W=V(I)$. Give $Z\cap W$ the <reduced induced subscheme> structure $\operatorname{Spec}(A/\sqrt I)$. These constructions agree under localization and therefore glue to a reduced closed subscheme $Z\hookrightarrow X$.

Let $Z'\hookrightarrow X$ be another <closed immersion> with the same underlying closed set. Affine-locally write $Z'=\operatorname{Spec}(A/J)$. Since $V(J)=Z\cap W$, its vanishing ideal is $\sqrt J=\sqrt I$, and the inclusion $J\subseteq\sqrt J$ induces a quotient homomorphism
$$
A/J\longrightarrow A/\sqrt J.
$$
Contravariance of the <spectrum of a commutative ring> gives a factorization
$$
Z\cap W\longrightarrow Z'\cap W\longrightarrow W.
$$
The quotient maps force these local factorizations to agree on overlaps, so they glue. They are also the only possible maps over $X$, which proves uniqueness.

Solved by gpt-5.6-sol high.