Prove that the product of compact sets in a product space is contained in a basic open set. The full question: Given topological spaces $X$ and $Y$, and compact sets $A \subseteq X$ and $B \subseteq Y$, and open set $W \subset X \times Y$ such that $A \times B \subseteq W$, then there exists $U \subseteq X$ and $V \subseteq Y$ open such that $A \times B \subseteq U \times V \subseteq W$
This was my attempt at a proof, but it seems way too complicated and am unable to do the final step:
Let $\{U_i \times V_i : i \leq n\}$ be a finite cover of basic open sets of $A \times B$ such that each $U_i \times V_i \subseteq W$.
Then define $U := \{x \in \cup U_i : \forall y \in B, (x,y) \in W\}$ and $V:=\{y \in \cup V_i : \forall x \in A, (x, y) \in W \}$.
I can show that both of these sets are open:
Given any $x \in U$, for every $y \in B$, $(x,y) \in W$ and so $\exists C_y \times D_y$ open and containing $(x,y)$ and contained in $W$. Since $\{D_y: y \in B\}$ is an open cover of $B$ pass to a finite subcover $\{D_1, .... D_m \}$. Then $x \in \cap_{1 \leq j \leq n} C_j$ and given any $x' \in \cap C_j$, then for every $y \in B$, $y \in D_k$ for some $k$ and thus $(x',y) \in C_k \times D_k$ and since $C_k \times D_k \subseteq W$, $x' \in U$.
This proves $U$ is open and a symmetric argument can be used to show that $V$ is open.
Am I on the right track here? Or am I making things needlessly complicated?
I am also confused about how to show $U \times V \subseteq W$.
Thank you for the help.
 A: If $\langle x,y\rangle\in U\times V$, then $\big(\{x\}\times B\big)\cup\big(A\times\{y\}\big)\subseteq W$, but that’s not enough to ensure that $\langle x,y\rangle\in W$. It would be better to handle one factor at a time. For each $\langle x,y\rangle\in A\times B$ there are open sets $U(x,y)$ in $X$ and $V(x,y)$ in $Y$ such that $\langle x,y\rangle\in U(x,y)\times V(x,y)\subseteq W$. Fix $a\in A$; then $\{V(a,y):y\in B\}$ is an open cover of $B$ in $Y$, so there is a finite $B_a\subseteq B$ such that $\{V(a,y):y\in B_a\}$ covers $b$. Now do what you did in proving that your $U$ is open: let $$U_a=\bigcap_{y\in B_a}U(a,y)\,.$$ Since $B_a$ is finite, this is an open nbhd of $a$ in $X$. Let
$$V_a=\bigcup_{y\in B_a}V(a,y)$$
and
$$G_a=\bigcup_{y\in B_a}\big(U_a\times V(a,y)\big)=U_a\times V_a\,;$$
then $G_a$ is open in $X\times Y$, and $\{a\}\times B\subseteq G_a\subseteq W$.
Now use the compactness of $A$: there is a finite $A_0\subseteq A$ such that $\{U_a:a\in A_0\}$ is an open cover of $A$, so that $A\times B\subseteq\bigcup\{G_a:a\in A_0\}\subseteq W$, and you’re almost done.
