# Variance of Logistic Distribution/Proof 1

## 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 = \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$

let:

 $\ds u$ $=$ $\ds \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^{-1}$ Integration by Substitution $\ds \leadsto \ \$ $\ds \frac {\d u} {\d x}$ $=$ $\ds -\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^{-2} \paren {-\frac 1 s \map \exp {-\dfrac {\paren {x - \mu} } s} }$ Power Rule for Derivatives, Chain Rule for Derivatives and Derivative of Exponential Function: Corollary 1 $\ds \leadsto \ \$ $\ds \dfrac 1 u - 1$ $=$ $\ds \paren {\map \exp {-\dfrac {\paren {x - \mu} } s} }$ $\ds \leadsto \ \$ $\ds \map \ln {\dfrac 1 u - 1}$ $=$ $\ds -\dfrac {\paren {x - \mu} } s$ $\ds \leadsto \ \$ $\ds -s \map \ln {\dfrac {1 - u} u} + \mu$ $=$ $\ds x$ $\ds \leadsto \ \$ $\ds \mu^2 -2 s \mu \map \ln {\dfrac {1 - u} u} + s^2 \map {\ln^2} {\dfrac {1 - u} u}$ $=$ $\ds x^2$

and also:

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

Then:

 $\ds \var X$ $=$ $\ds \int_{\to 0}^{\to 1} \paren {\mu^2 - 2 s \mu \map \ln {\dfrac {1 - u} u} + s^2 \map {\ln^2} {\dfrac {1 - u} u} } \rd u - \mu^2$ $\ds$ $=$ $\ds \mu^2 \int_{\to 0}^{\to 1} \rd u - 2 s \mu \int_{\to 0}^{\to 1} \map \ln {\dfrac {1 - u} u} \rd u + s^2 \int_{\to 0}^{\to 1} \map {\ln^2} {\dfrac {1 - u} u} \rd u - \mu^2$ $\ds$ $=$ $\ds \mu^2 - 2 s \mu \paren {\int_{\to 0}^{\to 1} \map \ln {1 - u} \rd u - \int_{\to 0}^{\to 1} \map \ln u \rd u } + s^2 \paren {\int_{\to 0}^{\to 1} \map {\ln^2} {1 - u} \rd u - 2 \int_{\to 0}^{\to 1} \map \ln {1 - u} \map \ln u \rd u + \int_{\to 0}^{\to 1} \map {\ln^2} u \rd u } - \mu^2$ Definite Integral of Constant and Difference of Logarithms $\ds$ $=$ $\ds \mu^2 - 2 s \mu \paren {\paren {-1} - \paren {-1} } + s^2 \paren {2 - 2 \paren {2 - \dfrac {\pi^2} 6 } + 2 } - \mu^2$ Expectation of Logistic Distribution:Lemma 1, Expectation of Logistic Distribution:Lemma 2, Lemma 1, Lemma 2 and Lemma 3 $\ds$ $=$ $\ds \dfrac {s^2 \pi^2} 3$

$\blacksquare$