prove an integral inequality on the unit square 
Let $f$ be a continuous function on the unit square. Prove that $\int_0^1 (\int_0^1 f(x,y) dx)^2 dy + \int_0^1 (\int_0^1 f(x,y) dy)^2 dx \leq (\int_0^1 \int_0^1 f(x,y)dx dy)^2 + \int_0^1 \int_0^1 f(x,y)^2 dx dy.$

I think writing the integrals as Riemann sums and taking limits should yield the result. If one divides the unit square into $n^2$ equal squares and picks a point $(x_i, y_j)$ in each square and defines $a_{ij} = f(x_i, y_j)$, then the corresponding inequality in terms of Riemann sums is $\frac{1}{n^3} \sum_i ((\sum_j a_{ij})^2 + (\sum_j a_{ji})^2) \leq \frac{1}{n^4} (\sum_{ij} a_{ij})^2 + \frac{1}{n^2}\sum_{ij} a_{ij}^2.$ How can I manipulate this inequality to get the result I want (e.g. maybe by writing it as $\sum_{ij} x_{ij}^2 \ge 0$ where the $x_{ij}$'s are carefully selected)?
 A: Solution I
The inequality becomes obvious  applying Fourier series in $L^2((0,1)\times (0,1))$ and in $L^2(0,1).$ Let
$$f(x,y)=\sum_{k,l=-\infty}^\infty a_{k,l}e^{2\pi ikx}e^{2\pi ily}$$
Then the left hand side is equal
$$\sum_{l=-\infty}^\infty |a_{0,l}|^2+\sum_{k=-\infty}^\infty |a_{k,0}|^2$$ while the right hand side takes the form
$$|a_{0,0}|^2+\sum_{k,l=-\infty}^\infty |a_{k,l}|^2$$
The equality occurs exactly when $a_{k,l}=0$ for $kl\neq 0.$ That means $f(x,y)=g(x)+h(y),$ for some functions $g$ and $h.$
Solution II
Let $g(x)=\int\limits_0^1f(x,y)\,dy.$ Then the inequality takes the form
$\int\limits_0^1\left (\int\limits_0^1 f(x,y)\,dy\right )^2\,dx+\int\limits_0^1 g(x)^2\,dx \\
 \le \left (\int\limits_0^1 g(x)\,dx\right )^2+\int\limits_0^1\int\limits_0^1 f(x,y)^2\,dx\,dy\qquad (*)$
If $g=0,$ the conclusion follows directly by the Cauchy-Schwarz inequality. Otherwise, by the same inequality, we get
$\int\limits_0^1 \left (\int\limits_0^1[f(x,y)-g(x)]\,dy\right )^2\,dx \le \int\limits_0^1\int\limits_0^1 [f(x,y)-g(x)]^2\,dx \,dy$
Raising to the square and rearranging terms gives inequality  $(*).$
