# How to compute variance of squared binomial RV?

If $T$ is distributed from a Binomial $\mathcal{B}(n,p)$ distribution, is there a simple way to compute the variance of $$\frac{T(n-T)}{n(n-1)}=\frac{\sum(X_i-\overline{X})^2}{n-1}$$ where the $X_i$'s are Bernoulli $\mathcal{Be}(n,p)$?

The motivation is that $\frac{T(n-T)}{n(n-1)}$ is the UMVU estimator of $\text{var}(X_i) = pq$. This is Exercise 2.3.2(b) in Lehmann/Casella and they write $$\text{var}\left( \frac{T(n-T)}{n(n-1)}\right) = \frac{pq}{n}[(q-p)^2+2pq/(n-1)].$$ My instinct is to compute the first four moments of the binomial distribution with the MGF and throw that into \begin{align*} var T(n-T) &= E[T^2(n-T)^2] - [E\,T(n-T)]^2\\ &= E[nT^2 - 2nT^3 + T^4] - [n ET-ET^2]^2. \end{align*} Is there a less tedious way of computing the variance?

• This is really not so bad. Just work out $E[T^i]$ for $i=1,2,3,4$ and you'll be done. Commented Feb 13, 2018 at 0:29
• It may be even easier is to work with the factorial moments, $E(T), E[T(T-1)], E[T(T-1)(T-2)]$ etc, and then write your $\text{Var}(T(n-T))$ in terms of those. Commented Feb 13, 2018 at 0:52

### A Basic Formula for Binomial Moments

Writing $D_p$ for the derivative with respect to $p$ and $D_q$ for the derivative with respect to $q$, observe that

$$p^jq^kn^{[j+k]}(p+q)^{n-j-k} = p^jq^kD_p^j D_q^k (p+q)^n = \sum_{i=0}^n \binom{n}{i} p^i q^{n-i}\,i^{[j]}(n-i)^{[k]}\tag{1}$$

where $x^{[m]} = x(x-1)\cdots(x-m-1)$ denotes the $m^\text{th}$ factorial power of $x.$

When we plug in $q=1-p$ this is identical to the formula for a Binomial expectation

$$\sum_{i=0}^n \binom{n}{i}p^i(1-p)^{n-i}\,i^{[j]}(n-i)^{[k]}=\mathbb{E}[T^{[j]}(n-T)^{[k]}].$$

The appearance of factorial powers shows the merit of Glen_b's suggestion to work with factorial moments; and the preceding shows exactly how the factorial moments are involved.

### Application to the Variance of $T(n-T)$

Since

$$T(n-T) = T^{[1]}(n-T)^{[1]}$$

and

$$(T(n-T))^2 = T^{[2]}(n-T)^{[2]} + (n-1) T^{[1]}(n-T)^{[1]}$$

involve the cases $(j,k)=(1,1)$ and $(j,k)=(2,2)$ (computing the latter identity involves about half of the algebraic work we will have to do), formula $(1)$ yields (without any algebraic manipulation beyond linearity of expectation)

\eqalign{ \operatorname{Var}(T(n-T)) &= \mathbb{E}[(T(n-T))^2] - \mathbb{E}[T(n-T)]^2 \\ &= \mathbb{E}[ T^{[2]}(n-T)^{[2]}] + (n-1) \mathbb{E}[T^{[1]}(n-T)^{[1]}]- \mathbb{E}[T^{[1]}(n-T)^{[1]}]^2 \\ &= p^2q^2 n^{[4]}(p+q)^{n-4} + (n-1) pq\, n^{[2]}(p+q)^{n-2} - \left(pq\,n^{[2]}(p+q)^{n-2}\right)^2. }

Replacing $q$ with $1-p$ reduces all the powers of $p+q$ to unity, simplifying the result (with only the most trivial algebraic changes) to

$$\operatorname{Var}(T(n-T)) = p^2(1-p)^2 n^{[4]} + (n-1)p(1-p)n^{[2]} - p^2(1-p)^2 (n^{[2]})^2.\tag{2}$$

For $n\gt 1,$ divide this by $(n(n-1))^2 = (n^{[2]})^2$ to obtain the variance of $T(n-T)/(n(n-1)).$

### Further simplification

We could stop here, but some simplification is possible.

By inspection, $(2)$ is clearly a multiple of $p(1-p)n(n-1)$, allowing it to be simplified with no effort to

$$\operatorname{Var}\left(\frac{T(n-T)}{n(n-1)}\right) = \frac{p(1-p)}{n(n-1)}\left(p(1-p)(n-2)^{[2]} + (n-1) -p(1-p)n^{[2]}\right).$$

Because the expression within the parentheses involves a multiple of the first difference $$n^{[2]}-(n-2)^{[2]}=6-4n,$$ (and working out this identity is where the rest of the algebraic work goes), it must be linear in $n$:

$$\operatorname{Var}\left(\frac{T(n-T)}{n(n-1)}\right) = \frac{p(1-p)}{n(n-1)}\left(p(1-p)(6-4n) + n-1\right).$$

Any further "simplification" of this would be a matter of taste.