This exercise comes from Ravi Vakil's notes. Suppose that $X$ is an integral Noetherian scheme, and $f \in K(X)^{\times }$ is a nonzero element of its function field. Show that $f$ has a finite number of zeros and poles.
Since $X$ is quasi-compact, we can reduce to the case when $X = \text{Spec } A$ where $A$ is a Noetherian integral domain. If $f = f_1/f_2$ for $f_i \in A$, then it suffices to prove the result for $f_i$.
In the section above the exercise, Vakil states that for any regular codimension 1 point $p$, we can talk about an element of the function field having a zero or a pole at $p$. My idea was to proceed by contradiction, so suppose that there are infinitely many of these regular codimension 1 points $p$. Initially, I thought I could contradict the Noetherianess of the ring $A$, however, I have been unable to do so.
I would appreciate any hints or suggestions on how to proceed by this (or a different proof).
Let $f\in A$ and $f\neq 0$, where $A$ is a noetherian domain. Let $Y$ be a prime divisor, i.e. an integral closed subset of codimension 1 of $Spec A$. It is $v_Y(f)>0$ if and only if $Y\subset V(f)$. Write $Y=V(\mathfrak{p})$ where $\mathfrak{p}$ is a height 1 prime ideal. So $Y\subset V(f)$ means $f\in \mathfrak{p}$. The primes containing $f$ are the primes of $A/fA$. The height 1 primes are the minimal primes of $A/fA$. But a noetherian ring can only have finitely many minimal primes.