Solution (source code)

= Solution

A complete <orthonormal sequence> $(e_n)$ has $\langle e_n,e_m\rangle=\delta_{nm}$ and dense <linear span>; equivalently, the only vector orthogonal to every $e_n$ is zero. The <Parseval identity> says $\|x\|^2=\sum_n|\langle x,e_n\rangle|^2$, with expansion $x=\sum_n\langle x,e_n\rangle e_n$ in the Hilbert <norm>.

Put $G(t,z)=(1-2zt+z^2)^{-1/2}$ and $D=1-2zt+z^2$. Direct differentiation gives
$$
G_t=zD^{-3/2},\quad G_{tt}=3z^2D^{-5/2},\quad G_z=(t-z)D^{-3/2},\quad G_{zz}=-D^{-3/2}+3(t-z)^2D^{-5/2}.
$$
Substitution yields $(1-t^2)G_{tt}-2tG_t+z^2G_{zz}+2zG_z=0$. Extracting the coefficient of $z^n$ in the <generating function> gives
$$
\boxed{(1-t^2)P_n''-2tP_n'+n(n+1)P_n=0,}
$$
the <Legendre differential equation>.