Green function of 1D Laplacian The Green function of the 1D laplacian $\frac{d^2}{dx^2}$ on functions in the interval $(0,1)$ with Dirichlet boundary conditions is known to be $G(x,y)=x(1-y)$ if $x<y$ and $G(x,y)=y(1-x)$ if $y<x$.
But the spectral theorem says that it should be $G(x,y)=\frac{2}{\pi^2}\sum_{n=1}^\infty \frac{1}{n^2}\sin(\pi nx)\sin(\pi ny)$
I have tried to reconcile these two results, but found it difficult. Any help?
 A: To show this result, we apply a Fourier sine series expansion to the function
$$
G(x) = \begin{cases} x(1-y) & x < y \\ y(1 - x) & x > y \end{cases}.
$$
(Note that this is reversed from the original question, but I'm pretty sure it's correct.)
We want to find the expansion in terms of sine waves:
$$
G(x) = \sum b_n \sin (\pi n x)
$$
Over the range $[0,1]$, we have
$$
\int_0^1 \sin (\pi n x) \sin (\pi m x) \, dx = \frac{1}{2} \delta_{mn},
$$
and so
$$
\int_0^1 G(x) \sin (\pi m x) \, dx = \sum_n \left[ b_n \int_0^1 \sin (\pi n x) \sin (\pi m x) \, dx \right] = \frac{1}{2} b_m.
$$ 
So we can calculate the coefficients of the series as
$$
b_n = 2 \int_0^1  G(x) \sin (\pi n x) \, dx.
$$
I'll leave it to you to do from here.  
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
\mrm{G}\pars{x,y} & =
{2 \over \pi^{2}}\sum_{n = 1}^{\infty}
{1 \over n^2}\,\sin\pars{\pi nx}\sin\pars{\pi ny} =
{1 \over \pi^{2}}\sum_{n = 1}^{\infty}
{\cos\pars{n\pi\bracks{x - y}} - \cos\pars{n\pi\bracks{x + y}} \over n^2}
\\[5mm] & =
{1 \over \pi^{2}}\,\Re\sum_{n = 1}^{\infty}
{\expo{n\pi\bracks{x - y}\ic} - \expo{n\pi\bracks{x + y}\ic} \over n^2} =
{\Re\mrm{Li}_{2}\pars{\expo{\ic\pi\verts{x - y}}} -
\Re\mrm{Li}_{2}\pars{\expo{\ic\pi\verts{x + y}}} \over \pi^{2}}
\label{1}\tag{1}
\end{align}
where $\ds{\,\mrm{Li}_{s}}$ is the
Polylogarithm Function. Note that
$\ds{\verts{x \pm y} \in \pars{0,2}}$. 

Moreover, with the
$\mbox{Jonqui$\grave{\mrm{e}}$re}$'s Inversion Formula:
\begin{align}
\left.\Re\mrm{Li}_{2}\pars{\expo{\ic\pi\xi}}
\,\right\vert_{\ \xi\ \in\ \pars{0,1}} & =
\Re\mrm{Li}_{2}\pars{\exp\pars{2\pi\ic\,{\xi \over 2}}} =
-\,{1 \over 2}\,{\pars{2\pi\ic}^{\, 2} \over 2!}
\,\mrm{B}_{2}\pars{\xi \over 2}
\\[5mm] & = 
\pi^{2}\,\mrm{B}_{2}\pars{\xi \over 2}
\end{align}
where $\ds{\mrm{B}_{n}}$ is a
Bernoulli Polynomial. Note that $\ds{\,\mrm{B}_{2}\pars{z} = z^{2} - z + 1/6}$ such that
\begin{align}
\left.\Re\mrm{Li}_{2}\pars{\expo{\ic\pi\xi}}
\,\right\vert_{\ \xi\ \in\ \pars{0,1}} & =
\pi^{2}\pars{{\xi^{2} \over 4} - {\xi \over 2} + {1 \over 6}} =
{\pi^{2} \over 12}\pars{3\xi^{2} - 6\xi + 2}
\end{align}

Expression \eqref{1} becomes:
\begin{align}
\left.\mrm{G}\pars{x,y}\,\right\vert_{\ x, y\ \in \pars{0,1}} & =
{\bracks{3\verts{x - y}^{2} - 6\verts{x - y} + 2} -
\bracks{3\verts{x + y}^{2} - 6\verts{x + y} + 2} \over 12}
\\[5mm] & =
-xy + {x + y - \verts{x - y} \over 2} =
\bbx{\left\{\begin{array}{lcrcl}
\ds{x\pars{1 - y}} & \mbox{if} & \ds{x} & \ds{<} & \ds{y}
\\[1mm]
\ds{y\pars{1 - x}} & \mbox{if} & \ds{x} & \ds{>} & \ds{y}
\end{array}\right.}
\end{align}
