# Variance of Logistic Distribution/Proof 3

## Theorem

Let $X$ be a continuous random variable which satisfies the logistic distribution:

$X \sim \map {\operatorname {Logistic} } {\mu, s}$

The variance of $X$ is given by:

$\var X = \dfrac {s^2 \pi^2} 3$

## Proof

From the definition of the logistic distribution, $X$ has probability density function:

$\map {f_X} x = \dfrac {\map \exp {-\dfrac {\paren {x - \mu} } s} } {s \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2}$
$\ds \var X = \int_{-\infty}^\infty x^2 \, \map {f_X} x \rd x - \paren {\expect X}^2$

So:

 $\ds \var X$ $=$ $\ds \frac 1 s \int_{-\infty}^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x - \mu^2$ $\ds$ $=$ $\ds \frac 1 s \paren {\int_{-\infty}^\mu \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x + \int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ Sum of Integrals on Adjacent Intervals for Integrable Functions $\ds$ $=$ $\ds \frac 1 s \paren {\int_\mu^\infty \dfrac {x^2 \map \exp {\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {\dfrac {\paren {x - \mu} } s} }^2} \rd x + \int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ rewriting the first integral $\ds$ $=$ $\ds \frac 1 s \paren {\int_\mu^\infty \dfrac {x^2 \map \exp {\dfrac {\paren {x - \mu} } s} } {\map \exp {\dfrac {2 \paren {x - \mu} } s} \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x + \int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ extracting $\map \exp {\dfrac {2 \paren {x - \mu} } s}$ from the denominator of the first integral $\ds$ $=$ $\ds \frac 2 s \paren {\int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ simplifying

From Sum of Infinite Geometric Sequence, for $x > \mu$, we have:

$\ds \sum_{n \mathop = 0}^\infty \paren {-1}^n \map \exp {-\dfrac {\paren {x - \mu} } s}^n = \dfrac 1 {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }$

Taking the derivative of both sides, we have:

 $\ds \sum_{n \mathop = 0}^\infty \paren {-\dfrac n s} \paren {-1}^n \map \exp {-\dfrac {\paren {x - \mu} } s}^n$ $=$ $\ds \dfrac { \map \exp {-\dfrac {\paren {x - \mu} } s} } {s \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2}$ $\ds \dfrac 1 s \sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {-\dfrac {\paren {x - \mu} } s}^n$ $=$ $\ds \dfrac { \map \exp {-\dfrac {\paren {x - \mu} } s} } {s \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2}$ simplifying

Therefore:

 $\ds \var X$ $=$ $\ds \frac 2 s \paren {\int_\mu^\infty x^2 \sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {-\dfrac {\paren {x - \mu} } s}^n \rd x} - \mu^2$ substitution from above $\ds$ $=$ $\ds \frac 2 s \paren {\sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {\dfrac {n \mu} s} \int_\mu^\infty x^2 \map \exp {-\dfrac {n x } s} \rd x} - \mu^2$ Fubini's Theorem $\ds$ $=$ $\ds \frac 2 s \paren {\sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {\dfrac {n \mu} s} \bigintlimits {-\dfrac s n \map \exp {-\dfrac {n x } s} \paren {x^2 + \frac {2 x s} n + \frac {2 s^2} {n^2} } } \mu \infty } - \mu^2$ Primitive of x squared by Exponential of a x $\ds$ $=$ $\ds \frac 2 s \paren {\sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {\dfrac {n \mu} s} \paren {0 + \dfrac s n \map \exp {-\dfrac {n \mu } s} \paren {\mu^2 + \frac {2 \mu s} n + \frac {2 s^2} {n^2} } } } - \mu^2$ $\ds$ $=$ $\ds 2 \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} \paren {\mu^2 + \frac {2 \mu s} n + \frac {2 s^2} {n^2} } } - \mu^2$ $\ds$ $=$ $\ds 2 \mu^2 \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} } + 4 \mu s \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} \dfrac 1 n } + 4 s^2 \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} \dfrac 1 {n^2} } - \mu^2$ $\ds$ $=$ $\ds 2 \mu^2 \paren {\dfrac 1 2 } + 4 \mu s \paren {\ln 2} + 4 s^2 \paren {\dfrac {\pi^2} {12} } - \mu^2$ Sum of Reciprocals of Squares Alternating in Sign and Definition of Mercator's Constant $\ds$ $=$ $\ds 4 \mu s \ln 2 + \dfrac {s^2 \pi^2} 3$

$\blacksquare$