TITLE: Does a regular function on an affine variety lie in the coordinate ring?(Lemma 2.1, Joe Harris)
QUESTION [9 upvotes]: I think the proof in for Lemma 2.1 in Joe Harris's book Algebraic Geometry, A First Course, does not work. (The statement is on Page 19, and the proof on Page 61.) The proof fails because that $gk_\alpha=h_\alpha$ is valid on $U_\alpha$ only, while the last but one equation on Page 61 must work on the whole domain of the regular function.
I have been trying to give a proof or find a counterexample. The proof for the case in which the variety is irreducible is easy. In the reducible case, I managed to reduce the question to the following one:

Suppose we are working with a algebraically closed field K and a regular function on an open subset of an affine variety is by definition a function locally representable as $F/G$, with $F,G\in K[x_1,...,x_n]$, and $G$ non-vanishing in a neighbourhood. Suppose we have a variety $V\subset \mathbb A^n$, $V=\cup V_i$ is the decomposition into irreducible components. Suppose we have $F,G\in K[x_1,...,x_n]$, such that $G$ divides $F$ in each $K[x_1,...,x_n]/I(V_i)$. Does it follow that $G$ divides $F$ in $K[x_1,...,x_n]/I(V)$?

Intuitively, this means that $I(F)~$  contains $I(G)~$  in each component implies the same thing on the whole variety. It seems quite reasonable. But I am not sure whether there will be any abnormality when considering "multiplicities". 
P.S.You may assume that $\cap V_i$ is nonempty, this is adequate for my purpose. Though I don't think this further assumption will help.
Thank you!

REPLY [4 votes]: Well, I noticed the same problem than you. But in my opinion, the proof on page 61 can be made correct with just the slight following precision : you get $k_\alpha g=h_\alpha$ only on $U_\alpha$. But then you can choose the $U_\alpha$ to be distinguished open sets $U_{f_\alpha}$. Then you have $f_\alpha k_\alpha g=f_\alpha h_\alpha$ on the whole $U_f$ (or even $\mathbb{A}^n)$ since $f_\alpha$ is zero outside of $U_{f_\alpha}$. Then you finish the proof as indicated using $f_\alpha k_\alpha$ and $f_\alpha h_\alpha$ instead of $k_\alpha$ and $h_\alpha$.