I'm reading Algebraic Geometry I by Görtz and Wedhorn and have a question concerning the proof of Lemma 1.55. $X$ is an irreducible affine algebraic set and $Z\subseteq X$ is an irreducible closed set. I don't understand the following sentence:
As the inclusion $Z\to X$ is a morphism of affine algebraic sets it induces a morphism $(Z,\mathcal{O}_Z)\to (X,\mathcal{O}_X)$.
Can you explain how that induced morphism is defined?
Edit: Here is my approach to prove $\mathcal{O}'_Z(U)\subseteq\mathcal{O}_Z(U)$.
Let $f\in\mathcal{O}'_Z(U)$. For each $x\in U$ we find by definition of $\mathcal{O}'_Z(U)$ an open set $V_x\subseteq X$ ($V$ for short) with $x\in V$ and $g\in\mathcal{O}_X(V)$ such that $f_{\mid U\cap V}=g_{\mid U\cap V}$. The morphism $(Z,\mathcal{O}_Z)\to (X,\mathcal{O}_X)$ implies that we have $g_{\mid Z\cap V}\in\mathcal{O}_Z(Z\cap V)$. By the first axiom of spaces with functions we get $g_{\mid U\cap V}\in\mathcal{O}_Z(U\cap V)$, hence $f_{\mid U\cap V}\in\mathcal{O}_Z(U\cap V)$. Finally $f$ can be obtained by gluing $f_{\mid U\cap V_x}$ for all $x\in U$. So by the axiom of gluing we get $f\in\mathcal{O}_Z(U)$.
Is that proof correct? If yes, is that the way the authors of the book probably wanted the reader to verify the claim or is there an easier way?
I assume your textbook is the one that can be found at https://www.math.ucdavis.edu/~blnli/buildings/bag.pdf.
Let $i: Z \to X$ denote the canonical inclusion map given by $i(z) = z$ for $z \in Z$. For any open subset $U \subset X$ one has a $k$-algebra homomorphism $i^*_U : \mathcal{O}_X(U) \to \mathcal{O}_Z(i^{-1}U) = \mathcal{O}_Z(U \cap Z)$ defined by $i^*_U(f) = f \circ i|_{U \cap Z}$ for any function $f \in \mathcal{O}_X(U)$ (cf. Definition 1.35(2) on p. 20). The map $i$ together with the collection of the homomorphisms $i^*_U$ for all open $U \subset X$ are the data that define the morphism $(Z,\mathcal{O}_Z) \to (X,\mathcal{O}_X)$. Note that while $i : Z \to X$ is injective, the maps $i^*_U : \mathcal{O}_X(U) \to \mathcal{O}_Z(U\cap Z)$ are usually not injective. If a function $f \in \mathcal{O}_X(U)$ vanishes at all points $z \in U \cap Z$ then $i^*_U(f)=0$ even though $f$ may not be identically $0$ on $U$. For instance, if $A = k[T_1,\ldots,T_n]$ is the coordinate ring of $\mathbb{A}^n(k)$ and $I \subset A$ is the defining ideal of $X$, while $J$ is the defining ideal of $Z$, then the map $i^*_X : \mathcal{O}_X(X) \to \mathcal{O}_Z(Z)$ is simply the quotient map $A/I \to A/J$ with kernel the ideal $J/I$ of $A/I$.