# Variance of Hat-Check Distribution

## Theorem

Let $X$ be a discrete random variable with the Hat-Check distribution with parameter $n$.

Then the variance of $X$ is given by:

$\var X = 1$

## Proof

From the definition of Variance as Expectation of Square minus Square of Expectation:

$\var X = \expect {X^2} - \paren {\expect X}^2$
$\ds \expect {X^2} = \sum_{x \mathop \in \Omega_X} x^2 \, \map \Pr {X = x}$

So:

 $\ds \expect {X^2}$ $=$ $\ds \sum_{k \mathop = 0}^n {k^2 \dfrac 1 {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} }$ Definition of Hat-Check Distribution $\ds$ $=$ $\ds \sum_{k \mathop = 1}^n {k^2 \dfrac 1 {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} }$ as the $k = 0$ term vanishes $\ds$ $=$ $\ds \sum_{y \mathop = n - 1}^0 \paren {n - y }^2 \dfrac 1 {y!} \sum_{s \mathop = 0}^{n - y} \dfrac {\paren {-1}^s} {s!}$ Let $y = n - k$ $\ds$ $=$ $\ds n^2 \sum_{y \mathop = 0}^{n - 1} \dfrac 1 {y!} \sum_{s \mathop = 0}^{n - y} \dfrac {\paren {-1}^s} {s!} - 2n \sum_{y \mathop = 0}^{n - 1} \dfrac y {y!} \sum_{s \mathop = 0}^{n - y} \dfrac {\paren {-1}^s} {s!} + \sum_{y \mathop = 0}^{n - 1} \dfrac {y^2} {y!} \sum_{s \mathop = 0}^{n - y} \dfrac {\paren {-1}^s} {s!}$ $\ds$ $=$ $\ds n^2 \sum_{k \mathop = 1}^n \dfrac 1 {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} - 2n \sum_{k \mathop = 1}^n \dfrac {n - k} {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} + \sum_{k \mathop = 1}^n \dfrac {\paren {n - k}^2 } {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!}$ Let $y = n - k$ $\ds$ $=$ $\ds n^2 \sum_{k \mathop = 1}^n \dfrac 1 {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} - 2n \sum_{k \mathop = 1}^n \dfrac {n - k} {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} + \sum_{k \mathop = 1}^n \dfrac {\paren {n - k}^2 } {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} + 2 \dfrac {n^2} {n!} - 2 \dfrac {n^2} {n!}$ adding $0$ $\ds$ $=$ $\ds n^2 \sum_{k \mathop = 0}^n \dfrac 1 {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} - 2n \sum_{k \mathop = 0}^n \dfrac {n - k} {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} + \sum_{k \mathop = 0}^n \dfrac {\paren {n - k}^2 } {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!}$ $\ds$ $=$ $\ds n^2 \sum_{k \mathop = 0}^n \dfrac 1 {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} - 2n \sum_{k \mathop = 0}^{n - 1} \dfrac {n - k} {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} + \sum_{k \mathop = 0}^{n - 1} \dfrac {\paren {n - k}^2 } {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!}$ as the $k = n$ term vanishes $\ds$ $=$ $\ds n^2 \sum_{k \mathop = 0}^n \dfrac 1 {\paren {n - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} - 2n \sum_{k \mathop = 0}^{n - 1} \dfrac 1 {\paren {n - 1 - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} + \sum_{k \mathop = 0}^{n - 1} \dfrac {\paren {n - k} } {\paren {n - 1 - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!}$ canceling terms $\ds$ $=$ $\ds n^2 - 2n + n \sum_{k \mathop = 0}^{n - 1} \dfrac 1 {\paren {n - 1 - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!} - \sum_{k \mathop = 0}^{n - 1} \dfrac k {\paren {n - 1 - k }!} \sum_{s \mathop = 0}^k \dfrac {\paren {-1}^s} {s!}$ Hat-Check Distribution Gives Rise to Probability Mass Function $\ds$ $=$ $\ds n^2 - 2n + n - \paren {n - 2}$ Hat-Check Distribution Gives Rise to Probability Mass Function and Expectation of Hat-Check Distribution $\ds$ $=$ $\ds n^2 - 2n + 2$

Then:

 $\ds \var X$ $=$ $\ds \expect {X^2} - \paren {\expect X}^2$ $\ds$ $=$ $\ds n^2 - 2n + 2 - \paren {n - 1}^2$ Expectation of Hat-Check Distribution: $\expect X = n - 1$ $\ds$ $=$ $\ds \paren {n - 1}^2 + 1 - \paren {n - 1}^2$ $\ds$ $=$ $\ds 1$

$\blacksquare$