TITLE: A lucky proof for the Basel problem.
QUESTION [21 upvotes]: I'll modify this part since I want the proof to be here.
$$\sum_{n=1}^\infty \frac{1}{n^2}=\frac43\sum_{n=0}^\infty \frac{1}{(2n+1)^2}=-\frac43\sum_{n=0}^\infty \int_0^1 x^{2n}\ln x dx=\frac43\int_0^1 \frac{\ln x}{x^2-1}dx$$
$$\int_0^1 \frac{\ln x}{x^2-1}dx\overset{x\rightarrow \frac{1}{x}}=\int_1^\infty \frac{\ln x}{x^2-1}dx\Rightarrow \sum_{n=1}^\infty \frac{1}{n^2}=\frac23 \int_0^\infty \frac{\ln x}{(x+1)(x-1)}dx$$
$$=\frac23 I(1,-1)=\frac23 \frac{\ln^2 (1)-\ln^2(-1)}{2(1-(-1))}=\frac23 \frac{\pi^2}{4}=\frac{\pi^2}{6}$$
Where we considered the following integral:
$$I(a,b)=\int_0^\infty \frac{\ln x}{(x+a)(x+b)}dx\overset{x\rightarrow  \frac{ab}{x}}=\int_0^\infty \frac{\ln\left(\frac{ab}{x}\right)}{(x+a)(x+b)}dx$$
Summing up the two integrals from above gives:
$$2I(a,b)=\ln(ab)\int_0^\infty \frac{1}{(x+a)(x+b)}dx=\frac{\ln(ab)}{a-b}\ln\left(\frac{x+b}{x+a}\right)\bigg|_0^\infty $$
$$\Rightarrow I(a,b)=\frac{\ln(ab)}{2}\frac{\ln\left(\frac{a}{b}\right)}{a-b}=\frac{\ln^2 a-\ln^2 b}{2(a-b)}$$

From here we know that:
$$\int_0^\infty \frac{\ln x}{(x+a)(x-1)}dx=\frac{\ln^2 a+\pi^2}{2(a+1)} $$
Also by plugging $b=-1$ in $I(a,b)$ we get:
$$I(a,-1)=\int_0^\infty \frac{\ln x}{(x+a)(x-1)}dx=\frac{\ln^2a -\ln^2 (-1)}{2(a-(-1))}=\frac{\ln^2 a+\pi^2 }{2(a+1)}$$
We already know that this is true from the linked post, but let's ignore it, since the linked post uses the Basel problem to prove the result.

Can someone prove rigorously that we are allowed to plug in $b=-1$ in order to get the correct result?

REPLY [7 votes]: Here is an 'elementary' proof of its validity. Note
$$ \frac1{(x+c)(x-1)}= \frac{1}{c+1} \left[ \frac{c-1}{(x+c)(x+1)} +\frac{2}{x^2-1} \right] $$
Then
$$ I= \int_0^\infty \frac{\ln x}{(x+c)(x-1)}dx = \frac{c-1}{c+1}I_1 + \frac{2}{c+1}I_2 \tag{1}$$
with
$$ I_1 =\int_0^\infty \frac{\ln x \>dx }{(x+c)(x+1)}
\overset{t=1/x}=\int_0^\infty \frac{\ln c \>dt}{(t+c)(t+1)}- I_1 = \frac{\ln^2 c}{2(c-1)}\tag{2}$$
and
$$ I_2 =\int_0^\infty \frac{\ln x}{x^2-1}dx = J(1)$$
where $J(\alpha)$ is defined as
$$ J(\alpha) =\int_0^\infty \frac{\ln (1-\alpha^2 + \alpha^2 x^2)}{2(x^2-1)}dx $$
$$ J'(\alpha) =\int_0^\infty \frac{\alpha dx}{1-\alpha^2 + \alpha^2 x^2} = \frac{\pi/2}{\sqrt{1-\alpha^2}}$$
Then
$$ I_2 = J(1) = \int_0^1 J'(\alpha) d\alpha = \frac{\pi}{2}\int_0^1 \frac{d\alpha}{\sqrt{1-\alpha^2}} = \frac{\pi^2}{4} \tag{3}$$
Substitute (2) and (3) into (1), we obtain the sought-after result
$$ I =\int_0^\infty \frac{\ln x}{(x+c)(x-1)}dx = \frac{\pi^2 + \ln^2 c}{2(c+1)}$$