# A random variable $X$ is number of boys out of $n$ children. Calculate $\operatorname{Var}(2X-n)$

Let a random variable $$X$$ be the number of boys out of $$n$$ children. The probability to have a boy or a girl is $$0.5$$. Calculate $$V(2X-n)$$.

I know that $$Var(2X-n)=4V(X)$$.

$$\mathbb{P}(X=k)={1\over 2^n}\binom{n}{k}$$. Thus $$\mathbb{E}(X)=\sum_{i=1}^n{1\over 2^n}\binom{n}{k}\cdot k$$, and $$\mathbb{E}(X^2)=\sum_{i=1}^n{1\over 2^n}\binom{n}{k}\cdot k^2$$. I'm not sure how to keep on.

## 2 Answers

$$V(2X - n) = V(2X) = 2^2V(X)$$ $$X$$ follows a binomial distribution with $$n$$ trials and $$p=0.5$$, which has $$V(X) = np(1-p)$$ $$V(2X - n) = 4np(1-p)$$

• $V(2X-n)=4np(1-p)=4n\cdot 0.5\cdot 0.5=n$? – J. Doe Feb 14 at 15:17
• looks good @J.Doe – Ahmad Bazzi Feb 14 at 15:17

HINT $$\mathrm{Var}\ X = \mathbb{E}\left[(X-\mathbb{E}[X])^2 \right] = \mathbb{E}\left[X^2 \right] - (\mathbb{E}[X])^2$$

UPDATE

The sums are handled separately. Note that $$\begin{split} \mathbb{E}[X] &= 2^{-n} \sum_{k=1}^n k \binom{n}{k} \\ &= 2^{-n} \sum_{k=1}^n k \frac{n (n-1)!}{k (k-1)! (n-k)!} \\ &= \frac{n}{2^n} \sum_{k=1}^n \frac{(n-1)!}{(k-1)! (n-k)!} \\ &= \frac{n}{2^n} \sum_{k=0}^{n-1} \frac{(n-1)!}{k! (n-k)!} \\ &= \frac{n}{2^n} 2^{n-1} = n/2. \end{split}$$

The last sum conversion uses the Binomial Theorem. The square sum is transformed similarly to $$n/4$$.

• If I sum up the two sums I have I get a monster sum which I don't know how to handle @gt – J. Doe Feb 14 at 15:13
• @J.Doe see the update – gt6989b Feb 14 at 15:46