Proving $\frac{\pi}{2}=\sum^\infty_{l=0} \frac{(-1)^l}{2l+1}\big(P_{2l}(x)+\text{sgn}(x)P_{2l+1}(x)\big)$ Can someone help me in proving the following:
$$
\frac{\pi}{2}=\sum^\infty_{l=0} \frac{(-1)^l}{2l+1}(P_{2l}(x)+\text{sgn}(x)\cdot P_{2l+1}(x)),
$$
for any value of $x$, $-1\le x\le 1$? (Here $P_l(x)$ is the Legendre polynomial of degree $l$, and $\text{sgn}(x)$ is the sign function.)  It's the craziest result I've seen (that the left hand side is actually independent of $x$), and it's seemingly difficult to prove.  I'm thinking maybe you could prove it using elliptic integrals somehow? Or maybe an easier way?
Putting it into the matlab verifies the result (going to high enough $l$).

Assume $x\in\mathbb{R}$, $|x|<1$. Then $|P_n(x)|=O(n^{-1/2})$ as $n\to\infty$, hence $$F(x,z):=\sum_{n=0}^\infty P_n(x)\frac{z^{n+1}}{n+1},\qquad G(x,z):=\sum_{n=1}^\infty P_n(x)\frac{z^n}{n}$$ converge absolutely and uniformly in $\{z\in\mathbb{C}:|z|\leqslant 1\}$, and clearly
\begin{align*}
F(x):=\sum_{n=0}^\infty\frac{(-1)^n}{2n+1}P_{2n}(x)&=\frac1{2i}\big(F(x,i)-F(x,-i)\big),
\\
G(x):=\sum_{n=0}^\infty\frac{(-1)^n}{2n+1}P_{2n+1}(x)&=\frac1{2i}\big(G(x,i)-G(x,-i)\big).
\end{align*}
Both $F(x,z)$ and $G(x,z)$ can be computed using the generating function $$P(x,t):=\sum_{n=0}^\infty P_n(x)t^n=\frac1{\sqrt{1-2xt+t^2}}$$ (here $t\in\mathbb{C}$, $|t|<1$): for $|z|<1$ we then have
\begin{align*}
F(x,z)&=\int_0^z P(x,t)\,dt&&=\log\frac{z-x+\sqrt{1-2xz+z^2}}{1-x},\\
G(x,z)&=\int_0^z\frac{P(x,t)-1}{t}\,dt&&=\log\frac2{1-xz+\sqrt{1-2xz+z^2}},
\end{align*}
and for $|z|=1$ we may take radial limits, by Abel's theorem. This gives, for $\color{blue}{x\geqslant 0}$, $$F(x,\pm i)=\log\frac{\pm i+\sqrt{x}}{1+\sqrt{x}},\qquad G(x,\pm i)=\log\frac2{(1+\sqrt{x})(1\mp i\sqrt{x})},$$ then $F(x)=\operatorname{arccot}\sqrt{x}$ and $G(x)=\arctan\sqrt{x}$, hence $F(x)+G(x)=\pi/2$.
The case $|x|<1$ follows by parity, and the cases $x=\pm 1$ are easy to check separately.
