Prove that if $V$ and $W$ are affine varieties, then $V \times W$ is an affine variety. I am working on the problem from "Ideas, Varieties and Algorithms" by David Cox, John Little and Donal O'Shea. Here is the homework problem for my course.

Let $V \subset k^n$ and $W \subset k^m$ be two affine varieties, and let
$$\begin{aligned}
V \times W &= \{(x_1, \dots, x_n, y_1, \dots, y_m) \in k^{n + m}|\\&\quad(x_1, \dots x_n) \in k^n, (y_1, \dots y_m) \in k^m\}
\end{aligned}$$
be their cartesian product.  Prove that $V \times W$ is an affine variety in $k^{n + m}$.  Hint: If $V$ is defined by $f_1, \dots, f_s \in k[x_1, \dots, x_n]$, then we can regard $f_1, \dots, f_s$ as polynomials in $k[x_1, \dots, x_n, y_1, \dots, y_m]$, and similarly for $W$.  Show that this gives defining equations for the cartesian product.

My Attempt
Assume that $V \subset k^n$ and $W \subset k^m$ are affine varieties.  That is:
$$\begin{aligned}
V &= \{(x_1, \dots, x_n) \in k^n |f_1=f_2=\cdots=f_s = 0 \}\\
W &= \{(y_1, \dots, y_m) \in k^m |g_1=g_2=\cdots=g_t = 0 \}
\end{aligned}$$
As already given
$$\begin{aligned}
V \times W &= \{(x_1, \dots, x_n, y_1, \dots, y_m) \in k^{n + m}|\\&\quad(x_1, \dots x_n) \in k^n, (y_1, \dots y_m) \in k^m\}
\end{aligned}$$
Using the hint for this problem, we have the following:


*

*If $V$ is defined by $f_1, \dots, f_s \in k[x_1, \dots, x_n]$, then we can regard $f_1, \dots, f_s$ as polynomials in $k[x_1, \dots, x_n, y_1, \dots, y_m]$

*Likewise, if $W$ is defined by $g_1, \dots, g_t \in k[y_1, \dots, y_m]$, then we can regard $g_1, \dots, g_t$ as polynomials in $k[x_1, \dots, x_n, y_1, \dots, y_m]$


I am not sure what to claim for this problem (e.g. for $V \cup W$, we claim $V \cup W = \mathbf{V}(f_ig_i : 1 \leq i \leq s, 1 \leq i \leq t)$), so I go on and write what I understand about this problem...
Set $(x_1, \dots, x_n, y_1, \dots, y_m) \in (V \times W)$, where $(x_1, \dots, x_n) \in V$ and $(y_1, \dots, y_m) \in W$.  Then, at the same time $f_1, \dots, f_s$ vanish at $(x_1, \dots, x_n)$ and $g_1, \dots, g_t$ vanish at $(y_1, \dots, y_m)$.
For the next step, I thought for around hours or so and then gave the following try:
Since $f_1, \dots, f_s \in k[x_1, \dots, x_n, y_1, \dots, y_m]$, and $f_1, \dots, f_s$ vanish at $(x_1, \dots, x_n)$, the set of those polynomials also vanish at $(x_1, \dots, x_n, y_1, \dots, y_m)$.  Likewise, since $g_1, \dots, g_t \in k[x_1, \dots, x_n, y_1, \dots, y_m]$ and $g_1, \dots, g_t$ vanish at $(y_1, \dots, y_m)$, the set of those polynomials also vanish at $(x_1, \dots, x_n, y_1, \dots, y_m)$.  So $f_ig_j$ for $1 \leq i \leq s$ and $1 \leq j \leq t$ vanish at $(x_1, \dots, x_n, y_1, \dots, y_m)$.
I think my proof needs a bit of adjustment or extra reasoning, but I'm not sure about this.
Any advices or comments about my approach?
 A: Looks like the correct approach. Note that what you're showing is that
$$V \times W = \{(x_1, \dots,x_n,y_1, \dots, y_m) \in k^{n+m} \mid f_1(x) = \dots = f_s(x) = 0, g_1(y) = \dots = g_t(y) = 0 \}.$$
If you feel uncomfortable because the defining equations should be polynomials in $x, y$ (instead of just in $x$ for the $f$'s and just in $y$ for the $g$'s), you might want to make things explicit.
Say $\hat {f_i}(x_1,\dots,x_n,y_1,\dots,y_m) = f_i(x_1,\dots,x_n)$ (i.e., $f_i$ explicitly considered as a polynomial in $x, y$) and similarly $\hat{g_j}(x_1,\dots,x_n,y_1,\dots,y_m) = g_j(y_1,\dots,y_m)$. Phrased this way, you're showing that
$$V \times W = \{(x_1, \dots,x_n,y_1, \dots, y_m) \in k^{n+m} \mid \hat{f_1}(x,y) = \dots = \hat{f_s}(x,y) = 0, \hat{g_1}(x,y) = \dots = \hat{g_t}(x, y) = 0 \},$$
but the right-hand side of this is of course still equal to 
$$\{(x_1, \dots,x_n,y_1, \dots, y_m) \in k^{n+m} \mid f_1(x) = \dots = f_s(x) = 0, g_1(y) = \dots = g_t(y) = 0 \},$$
so that is really just a notational issue.
