Let $X$ and $Y$ be varieties and let $\varphi:X\to Y$ be a morphism. If $Z$ is a closed subset of $Y$, is it true that $\varphi|_{\varphi^{-1}(Z)}:\varphi^{-1}(Z)\to Z$ is also a morphism? My knowledge of the subject is currently limited to Hartshorne's book up to exercise 3.5.
I think this result is true, and I would argue as follows: If $U$ is an open subset of $Z$ and $f$ is a regular function on $U$, then for any point $P\in U$ there is an open neighbourhood $V$ where $f$ can be expressed as a rational polynomial $g/h$. Since $g/h$ is regular on the open subset $Y-Z(h)$, the induced function $(g/h)\circ\varphi$ is regular on $\varphi^{-1}(Y-Z(h))$. Consequently $(g/h)\circ\varphi$ can be locally represented by a rational polynomial at every point of $\varphi^{-1}(V)\subseteq\varphi^{-1}(Y-Z(h))$. Now since clearly $(g/h)\circ\varphi \equiv f\circ\varphi$ on the set $\varphi^{-1}(V)$, and the point $P$ was arbitrarily chosen, it follows that $f\circ\varphi$ can be locally represented by a rational polynomial at any point of $\varphi^{-1}(U)$, and is therefore regular on $\varphi^{-1}(U)$.