Show that there exists a regular function that is not a quotient of polynomials Let $k$ be an algebraically closed field. Consider the Zariski-closed subset $Y=Z(xw-yz)\subset k^n$. On $U=Y\setminus Z(y,w)$ we consider the function
$$
f\colon U\to k, P=(a,b,c,d)\mapsto 
\begin{cases}
a/b &\text{if $P\in U\setminus Z(y)$,}\\
c/d & \text{if $P\in U\setminus Z(w).$}
\end{cases}
$$
My lectures notes claim that this is an example of a function that cannot be written as $f=g/h$ for $f,g\in k[x,y,z,w]$. I haven't been able to actually prove this. What I checked was that $xw-yz$ is an irreducible polynomial, and hence $Z(xw-yz)$ is irreducible. This would mean that if there were $g,h\in k[x,y,z,w]$, then $x/y=f/g$ on $U\setminus Z(y)$, and hence $xg=yf$ (since $U$ is also irreducible). Likewise $z/w=f/g$ yields $zg=wf$ on $U$. I can't find a contraction using this, which I need. Could someone help me out?
This question has been asked before (e.g. here: An example of a regular function over an open set), but the accepted answer talks about Cartier divisors, which I haven't seen before, so I'm actually hoping there is a more elementary argument.
 A: You can't find a contradiction from what you wrote because there isn't one.
In the function field $k[Y] = \mathrm{Frac}(A)$ where $A = k[x,y,z,w]/(xw-yz)$ we do indeed have $\frac{f}{g} = \frac{x}{y} = \frac{z}{w}$ exactly because $xw - yz = 0$ and in the function field every nonzero element becomes invertible.
However, you are not asking about rational functions (the functions that live in the function field) but about regular functions meaning that you must have $\frac{f}{g} = \frac{x}{y} = \frac{z}{w}$ in the function field and additionally $g$ vanish nowhere on $U$ so that this fraction produces a well-defined regular function.
Let's see why we must have $g$ vanish somewhere on $U$. We are going to turn this into a pure algebra question. If $g$ did not vanish on $U$ then $Z(g) \subset Z(y,w)$ since $Z(y,w)$ is the complement of $U$. Therefore, $I = (y,w) \subset \sqrt{(g)}$ because these are radical ideals. By Krull's prinicpal ideal theorem $\sqrt{(g)}$ has height $1$ and $I$ is a nonzero prime ideal inside $\sqrt{(g)}$ so $I = \sqrt{(g)}$. Thus $g \in I$ and $I^n = (g)$ for some power $n$.
Let $\mathfrak{m} = (x,y,z,w)$ be the maximal ideal corresponding to the cone point. Now compute that $\dim_{\kappa} I^n_{\mathfrak{m}} / \mathfrak{m} I^n_{\mathfrak{m}} \ge 2$ (think about if $y^n - w^n$ can be in $\mathfrak{m} I^n_{\mathfrak{m}}$) for all $n$ to show that it is impossible for $I^n$ to be principal.
A: NOTE. The following proof is incorrect, as indicated in the comment.
I don't think the answer you linked use anything about Cartier divisor.
Note that $f$ is undefined only at points in $Z(y,w)$, so if $f=g/h$
where $g,h\in k[x,y,z,w]$, then
$Z(y,w)=Z(h)$. But this is not possible.
If $y\mid h$ then any $(x,0,z,w)\in k^4$ with $w\ne 0$
lies in $Z(h)$ but not $Z(y,w)$.
If $y\nmid h$.
If $\text{deg}_yh\ge 1$, i.e.
$h= y^nP_n(x,z,w)+\ldots+P_0(x,z,w)$ for $n\ge 1$ and
$0\ne P_n(x,z,w)$. Because $0\ne P_0,P_n$ so $Z(P_0)\cup
Z(P_n)=Z(P_0P_n)\ne k^4$, meaning there exists
$(x_0,z_0,w_0)\in k^3$ s.t. $P_n(x_0,z_0,w_0)\ne 0$
and $P_0(x_0,z_0,w_0)\ne 0$. Thus, $h(x_0,y,z_0,w_0)\in k[y]$
has solution $y'\ne 0$.
If $\text{deg}_yh=0$ and $y\nmid h$, then
$h=h(x,z,w)\ne 0$. If we can find $(x_0,z_0,w_0)$ s.t.
$h=0$, then $(x_0,y,z_0,w_0)\in P(h)$ for any $y\ne 0$,
meaning $P(h)\ne P(y,w)$. Else, $P(h)=\emptyset\ne P(y,w)$.
