Let $Y \subset \mathbb{P}^n$ be a projective variety and let $U_i$ be the open set $x_i \neq 0$. Let $\phi_i : U_i \rightarrow \mathbb{A}^n$ be the isomorphism of varieties, defined e.g. in Hartshorne p. 10, that takes a point $P=(a_0,\cdots,a_n) \in \mathbb{P}^n$ to $(a_0/a_i,\cdots,a_n/a_i) \in \mathbb{A}^n$. Define $Y_i$ to be the image of the closed set $U_i \cap Y$ under $\phi_i$. Then $Y_i$ is an affine variety of $\mathbb{A}^n$.
Question: Hartshorne in the proof of Theorem 3.4(c), p. 18, says that $K(Y)=K(Y_i)$, where $K(\cdot)$ means field of rational functions (function field). Why is this true?