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.
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$.