Orthonormal basis for product $L^2$ space Let $(X,\mu)$ and $(Y,\nu)$ be $\sigma$-finite measure spaces such that $L^2(X)$ and $L^2(Y)$ . Let $\{f_n\}$ be an orthonormal basis for $L^2(X)$ and let $\{g_m\}$ be an orthonormal basis for $L^2(Y)$. I am trying to show that $\{f_n g_m\}$ is an orthonormal basis for $L^2(X\times Y)$. So far, I have attempted to show that if $h\in L^2(X\times Y)$, then
\begin{align}
h(x,y) &= \sum_m \sum_n \langle h , f_n g_m\rangle\,f_mg_m \\[0.3cm]
&= \sum_m \sum_n \left(\int_X \int_Y h(r,s) f_n(r)g_m(s) d\nu(s) d\mu(r)\right) f_n(x)g_m(y).\end{align}
Using the fact that $x\mapsto h(x,y) \in L^2(X)$ for almost every $y$ and similarly for $y\mapsto h(x,y)$, I can obtain 
$h(x,y) = \sum_{m=1} ^\infty (\int_X [\sum_{n=1} ^\infty (\int_Y h(r,s)g_n(s) d\nu(s))  f_m(r)] d\mu(r))  f_m(x)g_n(y)$.
However, I am unable to justify passing the summation outside the integral. Any suggestions?
 A: The way I would do it is first to show that $\{f_n\times g_m\}$ is orthonormal: indeed,
$$
\langle f_n\times g_m, f_s\times g_t\rangle = \langle f_n,f_s\rangle\,\langle g_m,g_t\rangle
=\delta_{n,s}\,\delta_{m,t} = \delta_{(n,m),(s,t)}.
$$
And then it only remains to show that it is a basis; for that, we can show that its orthogonal complement is zero. So, if $\langle h, f_n\times g_m\rangle = 0 $ for all $n,m$, we have
$$
0=\int_X\left(\int_Y h(x,y)\,g_m(y)\,d\nu(y)\right)\,f_n(x)\,d\mu(x);
$$
so, as $n$ is arbitrary, the function $x\mapsto\int_Y h(x,y)\,g_m(y)\,d\nu(y)$ is zero almost everywhere for each $m$. Let 
$$
E_m=\{x\in X: \int_Y h(x,y)\,g_m(y)\,d\nu(y)\ne0\}.
$$
Each $E_m$ is a null-set, and then so is its (countable) union $E$. Outside of $E$, 
$$
\int_Y h(x,y)\,g_m(y)\,d\nu(y)=0\ \ \ \mbox{for all } m.
$$
Thus for each $x\in X\setminus E$, $h(x,y)=0$ almost everywhere. As $|h|^2$ is integrable, its integral agrees with the iterated integrals, so 
$$
\int_{X\times Y} |h(x,y)|^2\, d(\mu\times\nu)=\int_X\int_Y|h(x,y)|^2\,d\nu(y)\,d\mu(x)
=\int_{X\setminus E}\int_Y|h(x,y)|^2\,d\nu(y)\,d\mu(x)=0.
$$
So $h=0$ in $L^2(X\times Y)$.
