# Identity theorem for rational functions

I would like to prove the identity theorem for rational functions on affine varieties.

Let $X \subseteq \mathbb{C}^n$, be an irreducible affine variety. Denote by $\Gamma(U)$ the set of locally rational functions defined on $U$, a Zariski-open subset of $X$.

Theorem: Suppose $\varphi\in \Gamma(V)$ and $U \subseteq V$ (Zariski-open subsets). If $\varphi|_U = 0$ then $\varphi= 0$. In other words, the restriction $\Gamma(V) \to \Gamma(U)$ is injective.

I was wondering if this theorem holds in more generality. Does it hold if we just assume $U \subseteq V$ open (in the usual, Hausdorff sense) subsets of $X$ and $V$ is connected?

Does the requirement that $X$ is irreducible somehow step in for connectedness of $V$?

Broader context: I'm trying to figure out why $\Gamma$ is only defined on Zariski open sets. The identity theorem might explain it. Suppose $V$ is a (possibly non-Zariski) open set and let $U \subseteq V$ be it's Zariski interior. Then $\Gamma(V) \to \Gamma(U)$ is surjective and by some identity theorem argument it is injective too. Hence having the non-Zariski $V$ doesn't add anything.

Edit: I realised the above argument breaks down, as the Zariski interior will be empty.

I guess my question really boils down to this: suppose you have two polynomials $\varphi$ and $\psi$ that agree on $U \subseteq X$ where $U$ is open in the Hausdorff sense. Do they also agree on a Zariski open subset?