Variance of number of tails in a coin-toss experiment

5.9k Views Asked by At

Let X be the random variable that equals the number of tails minus the number of heads when n fair coins are flipped. What is the variance of X?

I've run a simulation and the answer seems to be n, but I can't get at it myself. $V(X) = E(X^2) - E(X)^2$ and E(X) is zero, so $V(X) = E(X^2)$. Now $X = (2X_t - n)$ where $X_t$ is number of tails. $X^2 = 4X_t^2 + n^2 - 2X_tn$. Taking E() on both sides:

$E(X^2) = 4E(X_t^2) + n^2 - 2nE(X_t)$

we know that $E(X_t)=n/2$ so,

$E(X^2) = 4E(X_t^2) - n^2$

I tried to get $E(X_t^2)$ from a simulation and got the right answer again.

So the question boils down to: How to find the expectation of $E(X_t^2)$ where $X_t$ is the number of tails in n coin tosses.

2

There are 2 best solutions below

3
On

Note that $X=\sum\limits_{k=1}^nU_k$ where $U_k=1$ if the $k$th experiment produces tails and $U_k=-1$ otherwise. Then the sequence $(U_k)$ is independent with $E(U_k)=0$ and $E(U_k^2)=1$ for every $k$ hence $E(X)=0$ and $E(X^2)=nE(U_1^2)=n$, in particular the variance of $X$ is $n$.

2
On

Let $T$ denote the number of tails and $H$ the number of heads by $n$ tosses.

$X=T-H=T-\left(n-T\right)=2T-n$ and $\text{Var}\left(2T-n\right)=4\text{Var}\left(T\right)=4np\left(1-p\right)$ where $p$ denotes the probability of a tail by a toss. Note here that the distribution of $T$ is binomial. If the coin is unbiased then $p=\frac{1}{2}$ leading to $\text{Var}\left(X\right)=n$.

Used is here that $\text{Var}\left(aY+b\right)=a^{2}\text{Var}Y$ for random variable with $\mathbb{E}Y^{2}<\infty$.