Let $X,Y$ be compact spaces
if $f \in \mathcal C(X \times Y)$ and $\varepsilon > 0$ then $ \exists g_1,\dots , g_n \in \mathcal C(X) $ and $ \exists h_1, \dots , h_n \in\mathcal C(Y) $ such that $|f(x,y)- \sum_{k=1}^n g_k(x)h_k(y)| < \varepsilon $ for all $(x,y) \in X \times Y $.
Attempt at the solution:
$X,Y$ are compact which means that for all open covers of $X,Y$, there exists finite subcover.
So, I have been trying to think of a way to pick for all $ x_0 \in X $ and $ y_0 \in Y $, a function $g_{x_0} \in\mathcal C(X)$ and $ h_{y_0} \in\mathcal C(Y) $ such that $f(x_0,y_0) = g_{x_0}(x_0)h_{y_0}(y_0)$ because then there exists an open subset $U_{x_0,y_0}$ of $X \times Y$ such that $|f(x,y) - g_{x_0}(x)h_{y_0}(y)| < \varepsilon $ for all $(x,y) \in U_{x_0,y_0} $. Then by combining all these open subsets, we can form an open cover of $X,Y$ and so there is a finite subcover, $U_1,\dots , U_n $.
But I don't know how I can combine these open sets to get my functions $g_1,\dots ,g_n,h_1, \dots , h_n$ such that $|f(x,y)- \sum _{k=1}^n g_k(x)h_k(y)| < \varepsilon $ for all $(x,y) \in X \times Y$.
I feel like I almost have it :(