The *tube lemma* is as follows: 

> 
> Let $X$ and $Y$ be topological spaces. Let $Y$ be compact. Let $x \in X$. If $N$ is an open set in $X \times Y$ such that $x \times Y \subset N$, then there is an open set $W$ in $X$ such that $x \in W$ and $W \times Y \subset N$. 
> 
> 
> 

This is Lemma 26.8 in *Topology* by James R. Munkres, 2nd edition. I think I'm clear about it and its proof. 

Now how (to use the above result ) to derive the following?

> 
> Let $X$ and $Y$ be topological spaces. Let $A$ and $B$ be subspaces of $X$ and $Y$, respectively; let $N$ be an open set in $X \times Y$ such that $A \times B \subset N$. Suppose that $A$ and $B$ are compact. Then there exist open sets $U$ and $V$ in $X$ and $Y$, respectively such that 
>  $$A \times B \subset U \times V \subset N.$$ 
> 
> 
> 

My effort: 

(Based upon the valuable feedback from @GregoryGrant. )

> 
> Fix an $a \in A$. 
> 
> 
> Then, for each $b \in B$, there exists an open set $U\_{a, b}$ in $X$ and there exists an open set $V\_{a,b}$ in $Y$ such that 
>  $$a \times b \in U\_{a, b} \times V\_{a, b} \subset N. \tag{0} $$ 
> 
> 
> In this way, we obtain a covering $\left\{ \ V\_{a, b} \ \colon\ b \in B\ \right\}$ of $B$ by sets open in $Y$. Since $B$ is compact, there are finitely many of these sets, say, $V\_{a, b\_1}, \ldots, V\_{a, b\_n}$ such that 
>  $$B \subset \bigcup\_{j=1}^n V\_{a, b\_j}. \tag{1} $$
> 
> 
> Let us put $$V\_a \colon= \bigcup\_{j=1}^n V\_{a, b\_j} \tag{2} $$ 
>  and 
>  $$U\_a \colon= \bigcap\_{j=1}^n U\_{a, b\_j}. \tag{3} $$ 
> 
> 
> Then $U\_a$ is open in $X$, $V\_a$ is open in $Y$, $a \in U\_a$, and $B \subset V\_a$. Hence $$ a \times B \subset U\_a \times V\_a. \tag{4} $$
> 
> 
> Moreover, if $x \times y \in U\_a \times V\_a$, then $x \in U\_a$ and $y \in V\_a$; so $x \in U\_{a, b\_j}$ for *each* $j = 1, \ldots, n$ [Refer to (3) above.] and $y \in V\_{a, b\_k}$ for *some* $k = 1, \ldots, n$ [Refer to (2) above.]; thus $x \times y \in U\_{a, b\_k} \times V\_{a, b\_k}$. But by virtue of (0) above 
>  $$U\_{a, b\_k} \times V\_{a, b\_k} \subset N.$$
>  So $x \times y \in N$. Hence we have shown that $$ U\_a \times V\_a \subset N. \tag{5} $$
> 
> 
> Therefore, by (4) and (5) we can conclude that, for each element $a \in A$, we have a basis element $U\_a \times V\_a$ for the product topology on $X \times Y$ such that 
>  $$a \times B \subset U\_a \times V\_a \subset N. \tag{6} $$
> 
> 
> Now $\left\{\ U\_a \ \colon \ a \in A \ \right\}$ is a covering of $A$ by sets open in $X$; so there are finitely many of them to cover $A$; that is, there are finitely many sets, say, $U\_{a\_1}, \ldots, U\_{a\_m}$ open in $X$ such that 
>  $$A \subset \bigcup\_{i=1}^m U\_{a\_i}. \tag{7} $$
> 
> 
> Let's take 
>  $$U \colon= \bigcup\_{i-1}^m U\_{a\_i} \tag{8} $$
>  and 
>  $$V \colon= \bigcap\_{i=1}^m V\_{a\_i}. \tag{9} $$
>  Then the set $U$ is open in $X$ and the set $V$ is open in $Y$.
> 
> 
> Now we show that $U \times V \subset N$. Let $x \times y \in U \times V$. Then $x \in U$ and $y \in V$. So $x \in U\_{a\_r}$ for *some* $r = 1, \ldots, m$ [Refer to (8) above.] and $y \in V\_{a\_i}$ for *each* $i = 1, \ldots, m$ [Refer to (9) above.]. Thus, $x \times y \in U\_{a\_r} \times V\_{a\_r}$. But by virtue of (6) above 
>  $$ U\_{a\_r} \times V\_{a\_r} \subset N. $$ So
>  $x \times y \in N$, showing that $U \times V \subset N$. 
> 
> 
> Now we show that $A \times B \subset U \times V$. If $a \times b \in A \times B$, then $a \in A$ and $b \in B$. So $a \in U\_{a\_s}$ for *some* $s = 1, \ldots, m$ [Refer to (7) above.] and $b \in V\_{a\_i}$ for *each* $i = 1, \ldots, m$ [Refer to (6) and (9) above.]. Thus [Refer to (8) and (9) above.] $a \in U$ and $b \in V$. So $a \times b \in U \times V$ and thus $A \times B \subset U\times V$, as required. 
> 
> 
> From the preceding two paragraphs we have obtained 
>  $$ A \times B \subset U \times V \subset N. $$
>  Moreover, $U$ is open in $X$ and $V$ is open in $Y$. 
> 
> 
> 

Is this proof correct now? 

My initial attempt: 

> 
> For any $a \in A$ and for any $b \in B$, we have $a \times B \subset N$ and $A \times b \subset N$. 
> 
> 
> Since $a \times b \in N$, there is an open set $U\_a$ in $X$ and an open set $V\_b$ in $Y$ such that $a \times b \in U\_a \times V\_b \subset N$. 
> 
> 
> Now $\{U\_a \colon a \in A \}$ is a covering of $A$ by sets open in $X$. So there are finitely many points $a\_1, \ldots, a\_m$ such that 
>  $$A \subset \cup\_{i=1}^m U\_{a\_i}.$$
> 
> 
> Similarly, $\{V\_b \colon b \in B \}$ is a covering of $B$ by sets open in $Y$, and since $B$ is compact, therefore there are finitely many points $b\_1, \ldots, b\_n$ such that 
>  $$B \subset \cup\_{j=1}^n V\_{b\_j}.$$
> 
> 
> 

Can we take 
$$U \colon= \cup\_{i=1}^m U\_{a\_i} \ \ \ \mbox{ and } \ \ \ V \colon= \cup\_{j=1}^n V\_{b\_j}?$$