Rational functions on a reducible variety and restriction of rational functions I would appreciate help in proving any of the two following claims. 


*

*Let $M$ be an affine variety (not irreducible), $M'$ is the union of some irreducible components of $M$ while $M''$ is the union of the other ones. Show that if $x\in M'\setminus M''$ and $f$ is a rational function on $M$ such that it's restriction on $M'$ is regular at $x$, then $f$ is regular at $x$. 

*If $M=M_1\cup M_2\mathop{\cup}\cdots\mathop{\cup} M_q$ is the decomposition of $M$ into irreducible components, then $K(M)\simeq K(M_1)\times\cdots\times K(M_q)$ (here $K(M)$ is the algebra of rational functions). 
 A: *

*Since $U=M'\setminus M''$ is open, there is some regular function $h\in K[M]$ such that $x\in D(h)\subseteq U$. This follows from the fact that the open sets $D(h)=M\setminus Z(h)$ form a basis of the Zariski topology. In particular, since $f|_U$ is regular, so is $f|_{D(h)}$. This means that $f$ can be expressed as a fraction whose denominator is a power of $h$, and $h$ does not vanish at $x$. Note how this argument does not require the specific situation you are in: If the restriction of $f$ to any open neighbourhood of $x$ is regular, then $f$ is regular at $x$. In fact, this condition is both necessary and sufficient.

*For $f\in K[M]$, I will denote by $f_i$ the restriction of $f$ to $M_i$. I will also denote by $P_i=I(M_i)$ denote the vanishing ideal of the irreducible closed set $M_i\subseteq M$. Note that the $P_i$ are the minimal prime ideals of $K[M]$ and since $K[M]$ is reduced, we have $\bigcap_{i=1}^q P_i = \{0\}$. Consider the map
\begin{align*}
\phi:K[M]&\longrightarrow K(M_1)\times\cdots\times K(M_q) \\
 f &\longmapsto (f_1,\ldots,f_q)
\end{align*}
I claim that $\phi(f)$ is a unit if and only if $f$ is not a zero-divisor, implying the isomorphism you seek. 
Assume first that $\phi(f)$ is not a unit, i.e. there is some $1\le k\le q$ with $f_k=0$. This means that $f_k\in P_k$. Now for each $i\ne k$, pick some $g_i\in P_i\setminus P_k$. The function $g:=\prod_{i\ne k} g_i$ satisfies $g\notin P_k$ since otherwise, one of its factors would have to be in $P_k$ as $P_k$ is a prime ideal. Hence, $g\ne 0$. However, $g\cdot f\in\bigcap_{i=1}^q P_i = \{0\}$, so $f$ is a zero divisor. 
Conversely if $f\in K[M]$ is a zero-divisor, let $g\in K[M]$ be nonzero with $fg=0$. Then, here is some $1\le k\le q$ such that $g_k\ne 0$, i.e. the restriction of $g$ to $M_k$ is nonzero. But then $f_k,g_k\in K[M_k]$ satisfiy $f_kg_k=0$, where $g_k$ is nonzero and $K[M_k]$ is an integral domain. This proves $f_k=0$, so $\phi(f)$ is not a unit.
