Proof that $\mathcal{O}_X(D(f))=A(X)_f$ I am confused by the highlighted line in the following proof given by Gathmann in his set of algebraic geometry notes:

In particular this seems to be saying that if two functions $f$ and $h$ vanish at precisely the same points, then they are the same function. But surely $f(x)=x^2$ and $h(x)=x$ vanish at precisely the same points. Am I missing something here? Why can we identify $f_a$ and $h_a$ in proof?
 A: Here is a general way of looking at the argument that Gathmann is making. I'll assume we're working in affine space over an algebraically closed field.
Claim: Suppose a rational function $\varphi$ is defined on a distinguished open set $D(h)$. Then we can write $\varphi = \frac{g}{h^n}$ for some natural number $n$ and some polynomial $g$.
Proof: Since $\varphi$ is rational, we can write $\varphi = \frac{g'}{f}$, for polynomials $g'$ and $f$, and since $\varphi$ is defined on $D(h)$, $f$ does not vanish on $D(h)$. Thus, $D(h)\subseteq D(f)$, so $V(f)\subseteq V(h)$. By the Nullstellensatz, $h\in  I(V(h))\subseteq I(V(f)) = \sqrt{(f)}$. So there is some natural number $n$ and some polynomial $p$ such that  $h^n = pf$. Defining $g = pg'$, we have $\varphi = \frac{pg'}{pf} = \frac{g}{h^n}$. $\square$
If we don't actually care about the specific polynomial $h$, just the open set $D(h)$, we can go further and remove the power of $n$.
Claim: Suppose a rational function $\varphi$ is defined on a distinguished open set $U$. Then there are polynomials $g$ and $h$ such that $U = D(h)$ and $\varphi = \frac{g}{h}$.
Proof: Since $U$ is a distinguished open set, we have $U = D(h')$ for some polynomial $h'$. By the previous claim, we can write $\varphi = \frac{g}{(h')^n}$ for some natural number $n$ and some polynomial $g$. Let $h = (h')^n$. Since $D(h') = D((h')^n)$, we have $U = D(h)$, and $\varphi = \frac{g}{h}$.
