If $X, Y $ are compact metric spaces, prove that every continuous function $f: X \times Y \rightarrow \Bbb{R} $ is the uniform limit of functions of the form $$ g(x,y) = f_1(x)g_1(y) + f_2(x)g_2(y) + ... +f_n(x)g_n(y),$$ where $f_i \in C^0(X) $, and $ g_i \in C^0(Y)$, for $ i \in \{1, 2, . . . ,n\}.$
To use Stone-Weierstrass theorem, I should first check that functions of the form $ g(x,y) = f_1(x)g_1(y) + f_2(x)g_2(y) + ... +f_n(x)g_n(y),$ live in a subset of $C^0(X \times Y) $, and that a linear combination of $g_1(x,y), g_2(x,y)$ is again a subset of $C^0(X \times Y) $.
I'm not sure if this argument works:
Take $$ g(x,y) = f_1(x)g_1(y) + f_2(x)g_2(y) + ... +f_n(x)g_n(y).$$ Then, for $\bar{a} = (a_1, a_2, . . . , a_n),$ where $ \bar{a} \in Int(X),$
$$ g(\bar{a},y) = a_1g_1(y) + a_2g_2(y) + ... + a_ng_n(y).$$
$ g(\bar{a},y) $ lives in $C^0(Y)$ because $a_1, . . . a_n $ are real numbers and $C^0(Y)$ is a vector space. Therefore it also lives in $C^0(X \times Y)$. As this happens for every $\bar{a} \in Int(X)$, then $$ g(x,y) = f_1(x)g_1(y) + f_2(x)g_2(y) + ... +f_n(x)g_n(y)$$ lives in $C^0(X \times Y)$.
Similarily, for $\bar{b} = (b_1, b_2, . . . , b_n), \bar{b} \in Int(Y),$
$$ g(x,\bar{b}) = b_1f_1(x) + b_2f_2(x) + ... +b_nf_n(x), $$ who lives in $C^0(X)$ So it also lives in $C^0(X \times Y)$. Then, for every $\bar{b} \in Int(Y)$, $$ g(x,y) = f_1(x)g_1(y) + f_2(x)g_2(y) + ... +f_n(x)g_n(y)$$ lives in $C^0(X \times Y)$. In particular, $\alpha g_1(x,y) + \beta g_2(x,y)$ should live in $C^0(X \times Y)$.
$$ (\sum_{i=1}^n f_1(x)g_i(x))(\sum_{i=1}^n h_1(x)k_i(x))$$ would gives us products, like $f_1(x)g_1(y)h_1(x)k_1(y) = f_1h_1(x)g_1k_1(y) \in C^0(X \times Y)$
If $f_1(x) = 1 = g_1(y) $, and $f_2 = ... = f_n = 0$, the resulting function equals 1, I am not sure if literally I needed the constant function 1 to be in $C^0(X \times Y)$ or 1 is referring to something else, like the identity function...
Let $(x_1, y_1) \neq (x_2, y_2) $. Then, necesarily, the identity function would give $g(x_1, y_1) \neq g(x_2, y_2).$ Is this a correct way of using the definition of a set that separates points?
I'm aware of this other post: Application of Stone-Weierstrass to approximate $f\in C(X\times Y,\mathbb{R})$ where $X$ and $Y$ are compact Hausdorff spaces? , but Im having lots of little doubts, that I have written here...