[proofplan]
For regular functions, subtract the two functions and study the zero locus of the difference. The zero locus is closed and contains a nonempty open subset, which is dense because $X$ is irreducible. Hence the difference vanishes on all of $X$, so it is the zero element of the reduced coordinate ring. For rational functions, write the two rational functions as fractions in the fraction field of $k[X]$, restrict to a nonempty [open set](/page/Open%20Set) where all denominators are nonzero, and reduce equality to the regular-function case after clearing denominators.
[/proofplan]
[step:Show that a regular function vanishing on a nonempty open subset is zero]
Let $A:=k[X]$ denote the coordinate ring of $X$. Let $f\in A$ be a regular function such that there exists a nonempty open subset $U\subset X$ with $f(p)=0$ for every $p\in U$.
Define the zero locus of $f$ in $X$ by
\begin{align*}
V_X(f):=\{p\in X:f(p)=0\}.
\end{align*}
Because $f:X\to k$ is regular, $V_X(f)$ is closed in the Zariski topology on $X$. By assumption, $U\subset V_X(f)$.
Since $X$ is irreducible, [citetheorem:9409] implies that every nonempty open subset of $X$ is dense in $X$. Thus $\overline{U}=X$. Since $V_X(f)$ is closed and contains $U$, it contains $\overline{U}$, so $V_X(f)=X$.
Now write $X\subseteq \mathbb A_k^n$ and write
\begin{align*}
A=k[x_1,\dots,x_n]/I(X).
\end{align*}
Choose a polynomial $F\in k[x_1,\dots,x_n]$ whose residue class in $A$ is $f$. The equality $V_X(f)=X$ says exactly that $F(p)=0$ for every $p\in X$, hence $F\in I(X)$ by the definition of the vanishing ideal of $X$. Therefore the class of $F$ in $A$ is zero, so $f=0$ in $A$.
[guided]
The point of this step is to convert pointwise vanishing on an open set into algebraic vanishing in the coordinate ring. Let $A:=k[X]$, and let $f\in A$ be a regular function such that $f(p)=0$ for every point $p$ in some nonempty open subset $U\subset X$.
We define the zero locus of $f$ inside $X$ by
\begin{align*}
V_X(f):=\{p\in X:f(p)=0\}.
\end{align*}
This set is closed in the Zariski topology because regular functions on affine varieties have closed zero sets. The hypothesis says exactly that $U\subset V_X(f)$.
Now irreducibility is used topologically. Since $X$ is irreducible and $U$ is a nonempty open subset of $X$, [citetheorem:9409] gives that $U$ is dense in $X$. In symbols,
\begin{align*}
\overline{U}=X.
\end{align*}
Because $V_X(f)$ is closed and contains $U$, it must also contain the closure of $U$. Hence
\begin{align*}
X=\overline{U}\subset V_X(f)\subset X,
\end{align*}
so $V_X(f)=X$.
It remains to translate this back into the coordinate ring. Choose an affine embedding $X\subseteq \mathbb A_k^n$, and write
\begin{align*}
A=k[x_1,\dots,x_n]/I(X).
\end{align*}
Let $F\in k[x_1,\dots,x_n]$ be a polynomial representative of the class $f\in A$. The statement $V_X(f)=X$ means that $F(p)=0$ for every $p\in X$. By the definition of the vanishing ideal $I(X)$, this means $F\in I(X)$. Therefore the residue class of $F$ in $A$ is zero, which is precisely the assertion that $f=0$ in $k[X]$.
[/guided]
[/step]
[step:Apply the vanishing result to the difference of two regular functions]
Let $g,h\in k[X]$ and suppose there is a nonempty open subset $U\subset X$ such that $g(p)=h(p)$ for every $p\in U$. Define
\begin{align*}
f:=g-h\in k[X].
\end{align*}
Then $f(p)=0$ for every $p\in U$. By the preceding step, $f=0$ in $k[X]$. Hence $g-h=0$, so $g=h$ in $k[X]$.
[/step]
[step:Reduce equality of rational functions to equality of regular cross-products]
Let $\varphi,\psi\in k(X)$, and suppose that $U\subset X$ is a nonempty open subset contained in the common domain of definition of $\varphi$ and $\psi$ such that $\varphi(p)=\psi(p)$ for every $p\in U$.
By [citetheorem:9418], since $X$ is irreducible, $k[X]$ is an [integral domain](/page/Integral%20Domain). Therefore its fraction field $k(X)=\operatorname{Frac}(k[X])$ is defined. Choose representatives
\begin{align*}
\varphi=\frac{a}{b}
\end{align*}
and
\begin{align*}
\psi=\frac{c}{d}
\end{align*}
with $a,c\in k[X]$ and nonzero $b,d\in k[X]$.
Define the distinguished open subset
\begin{align*}
D(bd):=\{p\in X:b(p)d(p)\ne 0\}.
\end{align*}
Since $b$ and $d$ are nonzero in the domain $k[X]$, their product $bd$ is nonzero. If $D(bd)$ were empty, then $bd$ would vanish on all of $X$, so the first step would imply $bd=0$ in $k[X]$, a contradiction. Thus $D(bd)$ is nonempty and open.
The intersection
\begin{align*}
W:=U\cap D(bd)
\end{align*}
is a nonempty open subset of $X$: it is open as an intersection of open sets, and it is nonempty because two nonempty open subsets of an irreducible [topological space](/page/Topological%20Space) have nonempty intersection. On $W$, both fraction representatives are regular functions and the assumed equality gives
\begin{align*}
\frac{a(p)}{b(p)}=\frac{c(p)}{d(p)}
\end{align*}
for every $p\in W$. Since $b(p)d(p)\ne 0$ on $W$, multiplying by $b(p)d(p)$ gives
\begin{align*}
a(p)d(p)-b(p)c(p)=0
\end{align*}
for every $p\in W$.
The element $ad-bc\in k[X]$ is therefore a regular function vanishing on the nonempty open subset $W$. By the regular-function case, $ad-bc=0$ in $k[X]$. Hence $ad=bc$ in $k[X]$, which is exactly the equality
\begin{align*}
\frac{a}{b}=\frac{c}{d}
\end{align*}
in $\operatorname{Frac}(k[X])=k(X)$. Therefore $\varphi=\psi$ in $k(X)$.
[/step]