Rational fractions on affine algebraic sets

18 Views Asked by At

Let $X$ be an affine algebraic subset of $\mathbb{A}^n$. Let $f$ be a function on $X$ and $P_1, P_2, Q_1, Q_2\in k[X]$. Is it true that $f|_{X\backslash Z(Q_1)}=\frac{P_1}{Q_1}|_{X\backslash Z(Q_1)}\mbox{ and }f|_{X\backslash Z(Q_2)}=\frac{P_2}{Q_2}|_{X\backslash Z(Q_2)} \Leftrightarrow P_1 Q_2-P_2 Q_1=0$? I know that this is the case when $X$ is irreducible. Is there a counterexample when $X$ is reducible?

Edit: correction