(From Lang $SL_2$) Orthonormal bases for $L^2 (X \times Y)$ 
Lang $SL_2$ p. 13 :Let $\{\phi_i\}$, $\{\psi_i\}$ be orthonormal bases for $L^2(X)$ and $L^2(Y)$ respectively. Let $$\theta_{ij}(x,y) = \phi_i(x)\psi_i(y).$$ Then $\{\theta_{ij}\}$ is an orthonormal basis for $L^2(X \times Y)$. To see this, it is first clear that the $\theta_{ij}$ are of norm 1, and mutually orthogonal. Let $g \in \mathcal L^2(X \times Y)$ be perpendicular to all $\{\theta_{ij}\}$. Then $$\int_X\phi_i(x)dx\int_Y\psi_j(y)g(x,y)dy=0(*)$$ for all $i,j$. Hence $$x \mapsto\int_Y\psi_j(y)g(x,y)dy$$ is zero except for $x$ in a null set $S$ in $X$. If $x \notin S$, then for almost all $y$, we have $g(x,y) = 0$

Questions:
I assume that in ($*$) a double integral is meant, i.e. the integral over $Y$ should be inside the integral over $X$.
1) It is not clear to me how to get from ($*$) to the conclusion that the above map is zero for almost all y, and similarly from this to the fact that $g(x,y)$ is zero for almost all y. This would of course follow if the orthonormal basis were positive, which is not always the case since sines and cosines form an orthonormal basis for $L^2[0,1]$.
2) In the next page, Lang considers an orthonormal basis for $L^2(X \times X)$. He ascertains that it is {$\phi_i\otimes\bar\phi_j$}. Why do we have to take conjugate on the second element in $L^2(X \times X)$ but not in $L^2(X \times Y)$?
3) Does anyone know what is the difference between $L^2$ and $\mathcal L^2$?
 A: *

*Equation (*) says $\left<\phi_i,h_j\right>=0$ for all $i,j$, where $h_j$ is the function $x \mapsto\int_Y\psi_j(y)g(x,y)dy$. Since the $\phi_i$ form an orthonormal basis, it follows that (for each $j$) $h_j=0$ in $L^2$, i.e. is zero almost everywhere. Similarly, $0=h_j(x)=\left<\psi_j,g(x,-)\right>$ implies $g(x,-)$ is zero a.e.

*We don't have to, but is convenient in the context of integral operators. Recall in general that for a Hilbert space $H$ we identify $H$ with the conjugate dual, so there is an isomorphism $H\otimes \overline{H}\to B_{fin}(H)$ between the algebraic tensor product and finite-rank operators. Completing in the appropriate norm gives the isomorphism $H\widehat{\otimes} \overline{H}\to B_{h.s.}(H)$ between the Hilbert space tensor product and Hilbert-Schmidt operators. Applied to $H=L^2(X)$, and composing with the canonical map $L^2(X)\otimes \overline{L^2(X)}\to L^2(X\times X)$ given by $f\otimes g\mapsto k_{f,g}:=[(x,y)\mapsto f(x)\overline{g(y)}]$ (which we just proved to be a unitary isomorphism), we get the isomorphism $L^2(X\times X)\to B(L^2(X))$ given by $k_{f,g}\mapsto \left<-|g\right> f.$ This is the usual identification between bounded operators on $L^2$ and Hilbert-Schmidt operators.

*I think $L^2=\mathcal{L}^2/\sim$ where $f\sim g$ iff $f=g$ almost everywhere. Thus Lang carefully distinguishes between functions and equivalence classes of functions.

A: I think the reason $*$ implies the inside integral is $0$ for almost all $x$, and if $x$ is not in the null set $S$, then for almost all $y$ you have $g(x,y)=0$. To see it suppose you have $g(x,y)>0$ for some positive measure subset $K$ in $X\times Y$. Then by definition of product measure $K$'s projection onto $X$ and $Y$ should be sets of positive measure as well. Otherwise $m^{*}(K)=0$ contradicts our hypothesis. So you can find some functions $\phi_{i}$ such that $\sum k_{i}\phi_{i}\rightarrow \chi_{\pi_{x}(K)}$, and similarly $\sum h_{j}\psi_{j}\rightarrow \chi_{\pi_{y}(K)}$. Now we have $$\int_{Y}\psi_{j}(y)g(x,y)dy=0$$for almost all $x$. Adding up we have $$\int_{Y}h_{j}\psi_{j}g(x,y)dy=0\leftrightarrow \int_{\pi_{y}(K)}g(x,y)dy=0,\forall x\in X a.e$$
But we assumed $g(x,y)$ to be strictly positive on $K$ and $m^{*}(\pi_{y}(K))>0$. So for almost all $y$ we must conclude $g(x,y)=0$ regardless of $\psi,\phi$'s values. 
To answer the second question, I think $\phi_{i}\otimes \overline{\phi_{j}}$ and $\phi_{i}\phi_{j}$ can both be bases of $L^{2}(X\times X)$, but it might depend on the inner product you choose on this Hilbert space. I assume you choose $\int f\overline{g}$ in $L^{2}(X\times X)$ and $\int fg$ in $L^{2}(X\times Y)$, otherwise Lang's reasoning would not make sense. 
For $(3)$ I think $L^{2}$ denotes the Hilbert space of functions such that $\int_{X}|f|^{2}d\mu<\infty$. I am not sure what $\mathcal{L}^{2}$ means, I assume Lang might be considering a specific measure or something. 
