Spivak Chapter 13 Question 39 I have problem understanding the following statements that come from the Answers Book to question 39 of chapter 13 (note I've patched 2-21(c) above):
I have not posted the full question and answer as its lengthy and I only need help with this part.    Specifically I don't see how the second equation is an analogue to the first especially the part with the $1/2$ and the integral which follows.  For a bit of context, the question asks to prove Cauchy-Schwarz inequality for integrals as you might be able to recognize.    
 A: First note that symbol $\int_{a}^{b} f^{2}$ means the integral $$A=\int_{a} ^{b} \{f(x)\} ^{2}\,dx$$ and similarly let $$B=\int_{a} ^{b} \{g(x)\} ^{2}\,dx,\,C=\int_{a}^{b}f(x)g(x)\,dx$$ and the above use of symbols $A, B, C$ is to emphasize that these integrals are constants.
Next we can see that $$\int_{a}^{b} \left\{\int_{a} ^{b} \{f(x)g(y)-f(y)g(x)\} ^{2}\,dx\right\} \, dy$$ is equal to $$\int_{a}^{b} \left\{A\{g(y)\} ^{2}+B\{f(y)\}^{2}-2Cf(y)g(y)\right\}\, dy$$ (the terms with $y$ in the inner integral are constant as the integration is happening with respect to variable $x$) and this is clearly $AB+AB-2C^{2}$ or $2(AB-C^{2})$ as desired. 
A: Let $P$ be the equal partition of $[a,b]$:
$$ P=\{x_0,x_1,x_2,\cdots,x_n\}, x_i=a+i\frac{b-a}{n},i=0,1,2,\cdots,n. $$
and $t_k\in[x_i,x_{i+1}]$, $i=0,1,2,\cdots,n-1$, $\Delta x=x_{i+1}-x_i=\frac{b-a}{n}$. Then
\begin{eqnarray}
\sum_{i=1}^nf^2(t_i)\Delta x\cdot\sum_{i=1}^ng^2(t_i)\Delta x=\left(\sum_{i=1}^nf(t_i)g(t_i)\Delta x\right)^2+\frac{1}{2}\sum_{i,j=1}^n[(f(t_i)g(t_j)-f(t_j)g(t_i)]^2\Delta^2
\end{eqnarray}
Letting $n\to\infty$ and using the definition of Riemann integrals, one has
$$ \int_a^bf^2(x)dx\int_a^bg^2(x)dx=\left(\int_a^b f(x)g(x)dx\right)^2+\frac12\int_a^b\int_a^b\left[f(x)g(y)-f(y)g(x)\right]^2dxdy. $$
