TITLE: Zariski topology finer than product topology
QUESTION [10 upvotes]: I understand that variants of this question have been asked before on this site, but I can't seem to find a satisfactory answer for my particular question. 
Notation: we work over an algebraically closed field $k$, and $Z(S)\subseteq \mathbb{A}^n$ denotes the zero locus of a subset $S\subseteq k[x_1,\dots,x_n]$.
Given Zariski closed subsets $X_i,Y_i\in\mathbb{A}^1$ for $1\leq i \leq n$, I'd like to show that $\bigcup_{k=1}^{n}X_i \times Y_i$ is Zariski closed in $\mathbb{A}^1\times \mathbb{A}^1=\mathbb{A}^2$ (where we identify these two sets in the obvious way).
Attempt at a solution: it suffices to show that $X_1\times Y_1$ is closed, as a finite union of closed sets is closed. Also, we know $X_1=Z(U)$ and $Y_1=Z(W)$ for some subsets $U,W\subseteq k[x]$. This is where I am stuck. Obviously, I'd like to write $X_1 \times Y_1=Z(Y)$ for some $Y\subseteq k[x_1,y_1],$ but I can't seem to find $Y$. All solutions I have found online are not quite satisfactory, mostly appealing to the fact that the product of lines and points is again a Zariski closed set.
Any help is appreciated, thank you.

REPLY [6 votes]: What's going on here is greatly clarified if you think of the two coordinate spaces of the product as being separate, totally unrelated spaces.  So instead of thinking of $U$ and $V$ as both being subsets of the same polynomial ring $k[x]$, they are now subsets of two separate polynomial rings: $U\subseteq k[x_1]$ and $V\subseteq k[y_1]$. Now it's easy to guess what $Y$ should be: just take the union of $U$ and $V$ inside $k[x_1,y_1]$.
In terms of your original notation, this means $$Y=\{f(x_1):f(x)\in U\}\cup\{g(y_1):g(x)\in V\}.$$  I'll leave it to you to verify that this $Y$ works.