Probability Distributions – Compute Variance of Logistic Distribution

definite integralsintegrationprobability distributionsreference-request

Consider a random variable $X$ with normalized logistic distribution(
so that its pdf is $\frac{e^{-x}}{(1+e^{-x})^2}$). It is well known
that its variance $V$ equals $\frac{\pi^2}{3}$ but I couldn't find a direct proof so far.

It is easy to see that

$$V=\int_{-\infty}^{\infty}\frac{x^2e^{-x}}{(1+e^{-x})^2}dx=
\int_{0}^{1}\Bigg(\ln\bigg(\frac{p}{1-p}\bigg)\Bigg)^2dp$$

This last integral is well-known according to Wikipedia, but the only
reference it gives for this is a certain link in the OEIS and I got lost
browing through the miscellaneous links in that OEIS page.

I am aware that one can use the moment generating function to compute $V$, but I'd prefer a solution that tackles the integral above directly, preferably without using complex analysis.

Any help appreciated.

Best Answer

Hint. You may write $$\begin{align} \int_{-\infty}^{\infty}\frac{x^2e^{-x}}{(1+e^{-x})^2}dx &=\int_{-\infty}^{0}\frac{x^2e^{-x}}{(1+e^{-x})^2}dx +\int_{0}^{\infty}\frac{x^2e^{-x}}{(1+e^{-x})^2}dx\\\\ &=\int_{0}^{\infty}\frac{x^2e^{x}}{(1+e^{x})^2}dx +\int_{0}^{\infty}\frac{x^2e^{-x}}{(1+e^{-x})^2}dx\\\\ &=\int_{0}^{\infty}\frac{x^2e^{x}}{e^{2x}(1+e^{-x})^2}dx +\int_{0}^{\infty}\frac{x^2e^{-x}}{(1+e^{-x})^2}dx\\\\ &=2\int_{0}^{\infty}\frac{x^2e^{-x}}{(1+e^{-x})^2}dx\\\\ &=2\int_{0}^{\infty}x^2\sum_{n=1}^\infty n(-1)^{n-1}e^{-nx} dx\\\\ &=2\sum_{n=1}^\infty n(-1)^{n-1}\int_{0}^{\infty}x^2e^{-nx} dx\\\\ &=2\sum_{n=1}^\infty n(-1)^{n-1}\frac2{n^3}\\\\ &=4\sum_{n=1}^\infty (-1)^{n-1}\frac1{n^2}\\\\ &=\frac{\pi^2}3 \end{align} $$ where the interchange between sum and integral is easy to justify and where we have used some standard evaluations.