TITLE: Hartshorne Lemma (I 3.6)
QUESTION [6 upvotes]: Let $X$ be a variety, $Y \subset \mathbb{A}^n$ an affine variety and $\psi:X \rightarrow Y$ a map such that $x_i \circ \psi$ is a regular function. We want to show that $\psi$ is a morphism of varieties. Since regular functions form a ring, then for any polynomial $f \in k[x_1,\cdots,x_n]$ we have that $f \circ \psi$ is regular and so $\psi$ is continuous. Now we need to show that if $g$ is a regular function on $Y$, then for any open set $V$ of $Y$ the function $g \circ \psi: \psi^{-1}(V) \rightarrow k$ is regular. Hartshorne says that this follows since $g$ is locally a quotient of polynomials.
Here is my "objection": to show that $f \circ \psi$ is regular, we need to show that it is locally a quotient of polynomials, where the polynomials correspond to the "correct" ambient space of $X$. For example, if $X$ is a projective variety, then we need $f \circ \psi$ to be a quotient of homogeneous polynomials of equal degree. In other words, $f \circ \psi$ is locally a quotient of polynomials only after passed through $\psi$... So, what am i missing here?

REPLY [6 votes]: The assumption is that $x_i\circ\psi$ is regular for all $i=1,\ldots,n$. Thus, locally in whatever coordinates we have on $X$, we can express $x_i\circ\psi$ as a quotient of polynomials (of equal degree if $X$ is quasi-projective). In other words, we can write the function as $$\psi(p) = (\psi_1(p),\ldots,\psi_n(p))$$ with $p\in X$ and where each $\psi_i(p)$ is a quotient of polynomials in the ambient coordinates on $X$.
Now whatever the expression is for $f$ as a polynomial in the $x_i$'s, we can express $f\circ\psi$ as a quotient of polynomials, namely, we have $$f\circ\psi(p) = f(\psi_1(p),\ldots,\psi_n(p))$$ which is clearly also a quotient of polynomials in the coordinates on $X$, since the $\psi_i(p)$ are and $f$ is a polynomial (and again, things work out in the quasi-projective case).