For simplicity, we consider a two variable function $f = f(x,y): \mathbb{R}^2 \to \mathbb{R}$. As stated in this post, in general, we can't write $$f(x,y) = g(x) h(y)$$ as a product of single variable functions, for some $g = g(x)$ and $h = h(y)$.
My question is following: Can we decompose $f$ into an infinite sum of functions of separation variable, that is, do there exist sequence $(g_n)_{n=1}^{\infty}$ and $(h_n)_{n=1}^{\infty}$ of functions of single variable such that $$f(x,y) = \sum_{n=1}^{\infty} g_n(x) h_n(y)$$ for all $(x,y) \in \mathbb{R}^2$?
Any hint or example is welcome.