<s>[INST] Computing an infinite trigonometric sum $\sum \frac{2}{n^2 \pi^2} \cos(n \pi x)\cos(n \pi y)$ Let $G(x,y) = \sum_{n=1}^\infty \frac{2}{n^2 \pi^2} \cos(n \pi x)\cos(n \pi y)$ 
I'm trying to compute this sum by understanding it as an integral kernel. This question comes from Dym and Mckean Fourier Series and Integrals Ex 1.7.14:  
Consider the cosine basis on $L^2[0,1]$ defined by $f_n(x) = \sqrt 2 \cos(n \pi x)$ for $n \ge 1$ and $f_0 = 1$. Define the operator $F$ by $F f_n = \frac{1}{n^2\pi^2} f_n$ acting only on the subspace $n \ge 1$. 
It turns out that $F f(x) = \int_0^1 G(x, y) f(y) dy$ for $f \in L^2[0,1]$.
Now let $u = f_n''$ for some unspecified $n \ge 1$ .
$$F (f_n'') = -f_n $$ 
$$(F(f_n''))'' = -f_n''$$
$$(F u)'' = -u$$
$$(Fu)'(x) =-\int_0^x u(y)dy + K_1$$
$K_1 = 0$ because $(F u)'(0) = C \sin(0) = 0$
$$(Fu)(x) = -\int_0^x \int_0^y u(z)dz\,dy + K_2$$
$K_2 = \int_0^1\int_0^x \int_0^y u(z)dz\,dy\,dx$ because $\int_0^1 (Fu)(x) dx = \int_0^1 C \cos (2 \pi n x) dx = 0$ 
Now changing order of integration
$$ (Fu)(x) = - \int_0^x (x - z)u(z) dy + K_2$$
$$ = - \int_0^x (x - z)u(z) dy + \int_0^1\int_0^x (x - z)u(z) dz\,dx$$
$$ =... + \int_0^1\int_z^1(x -z)u(z)dx\,dz$$
$$ =... + \int_0^1u(z) [(1 - z^2)/2 - z(1-z)] dz $$
$$ = ... + \int_0^1 u(z) (z - 1)^2/2 dz$$
$$ = - \int_0^x (x - z)u(z) dz + \int_0^1 u(z) (z - 1)^2/2 dz$$
$$ = - \int_0^x (x - z)u(z) dz + \int_0^x u(z) (z - 1)^2/2 dz+ \int_x^1 u(z) (z - 1)^2/2 dz$$
$$ = \int_0^1 T(x,z) u(z) dz$$
where $T(x,y) = (y^2 + 1)/2 - x $ for $y < x$ and $(y-1)^2/2$ for $y > x$ 
and by necessity $T(x,y) = G(x,y)$
Unfortunately, I don't think this is the right function and it doesn't even look symmetric in $x,y$. I am looking for help for the correct derivation which should lead to $G(x,y) = \frac{x^2 - x + y^2 -y - |x-y|}{2} + 1/3$
Edit:
Even though $T(x,y)$ gives rise to the same operator $F$, it may not equal to $G(x,y)$ since they can differ by any function $\Delta(x)$ so that $T(x,y) + \Delta(x) = G(x,y)$, since $\int_0^1\Delta(x) f_n(y) dy = 0$. Since $\int G(x,y) dy = 0$, we should require $\Delta(x) = -\int_0^1T(x,y)dy = -1/6 + x^2/2$ so that $G(x,y) = (y^2 + 1)/2 - x - x^2/2 + 1/6 $ for $y < x$ and $(y-1)^2/2 + x^2/2 + 1/6$ for $y > x$ and this is the book's answer. 
 [/INST] Marty Cohen is correct in his approach to this $G(x,y)$ but there is the sign error in the trig expressions.  
Defined on the interval $0 < t < P$, it is fairly easy to demonstrate that the function:
\begin{equation}
h(t)=\pi^2 \left[ \left( \frac{t}{P} \right)^2 -\left( \frac{t}{P} \right) + \frac{1}{6} \right]
\end{equation}
has a Fourier series expansion of:
\begin{equation}
h(t) = \sum\limits_{n = 1}^{\infty} 
\frac{
\cos\left( 2 \pi \frac{n}{P} t \right)
}{n^2}
\end{equation}
The polynomial, $h(t)$, is Bernoulli Polynomial, $B_2(\frac{t}{P})$ which has been scaled appropriately.
Using $h(t)$ above and setting $P=2$ the closed form of $g(z)$ above is given by:
\begin{equation}
g(z) = \left[ \left(\frac{z}{2}\right)^2 - \left(\frac{z}{2}\right) + \frac{1}{6} \right]
\end{equation}
This is exactly the same value of $g(z)$ found above, so his exposition on the approch is correct.
Proceeding with the reasoning of Marty Cohen but with the sign correction for $cos(a)cos(b)$:
\begin{align}
G(x,y) &= g(x-y) + g(x+y)
\\
&= \left[ \left( \frac{x-y}{2} \right)^2 - \left( \frac{x-y}{2} \right) + \frac{1}{6} \right]
\\
&+ \left[ \left( \frac{x+y}{2} \right)^2 - \left( \frac{x+y}{2} \right) + \frac{1}{6} \right]
\\
&= \left[ \frac{x^2}{4} - xy + \frac{y^2}{4} - \frac{x-y}{2} + \frac{1}{6} \right]
\\
&+ \left[ \frac{x^2}{4} + xy + \frac{y^2}{4} - \frac{x+y}{2} + \frac{1}{6} \right]
\\
&= \frac{x^2 + y^2}{2} -x +\frac{1}{3}
\end{align}
where the domain for $x$ and $y$ are:


*

*$0 \le (x + y) \le 2$

*$0 \le (x - y) \le 2$


This is different way to answer to the question: "What is G(x,y) in closed form?" It is not in keeping with the the essence of the question posed by the OP so it is not a proper answer.  
None the less, this confirms Marty Cohen's approach (less the sign error) is correct.
</s>