Let $X$ be a $B(n, 1/2)$ random variable with $n>=1$, show that the probability that $X$ is even is $1/2$.

1.9k Views Asked by At

I found the following an answer here. But I don't completely understand it.

I get that the binomial random variable calculates the probability of exactly $j$ successes and $n-j$ failures in $n$ independent experiments, each of which is successful with probability $p$.

I understand how to get to $P\{X~\text{odd}\}=1/2$ and $P\{X~\text{even}\}=1/2$. But I don't completely understand the answer given by @Dilip Sarwate (previously linked) quoted:

A more general question might be "What is the probability that a $(n,p)$-Binomial random variable $X$ is even?" Generalizing on my hint on the main question, $$ \begin{align*} \left((1-p) + p\right)^n &= \sum_{k=0}^n\binom{n}{k}p^k(1-p)^{n-k}\\ &= \sum_{k=0}^{\lfloor n/2 \rfloor}\binom{n}{2k}p^{2k}(1-p)^{n-2k} + \sum_{k=0}^{\lfloor n/2 \rfloor}\binom{n}{2k+1}p^{2k+1}(1-p)^{n-(2k+1)}\\ &= P\{X~\text{even}\} + P\{X~\text{odd}\} \end{align*} $$ and $$ \begin{align*} \left((1-p)-p\right)^n &= \sum_{k=0}^n \binom{n}{k}(-p)^k(1-p)^{n-k}\\ &= \sum_{k=0}^{\lfloor n/2 \rfloor}\binom{n}{2k}p^{2k}(1-p)^{n-2k} - \sum_{k=0}^{\lfloor n/2 \rfloor}\binom{n}{2k+1}p^{2k+1}(1-p)^{n-(2k+1)}\\ &= P\{X~\text{even}\} - P\{X~\text{odd}\} \end{align*} $$ giving that $$P\{X~\text{even}\} = \frac{1}{2}(1 + (1-2p)^n) = \frac{1}{2} + \frac{1}{2}(1-2p)^n$$ which is $\frac{1}{2}$ if $p = \frac{1}{2}$ and converges to $\frac{1}{2}$ as $n \to\infty$ except when $p = 1$, in which case the probability alternates between $0$ and $1$ depending on the parity of $n$ (as is obvious without all the above calculation).

The binomial identity is: $$ (x+y)^n = \sum_{k=0}^{n}\binom{n}{k}x^k y^{n-k} $$

How come he puts $(1-p)$ before $p$ in $((1-p) + p)^n$ and $((1-p) - p)^n$ but in the other side of the sign there is $\binom{n}{k}p^k(1-p)^{n-k}$ and not $\binom{n}{k}(1-p)^k(p)^{n-k}$? (This is, the order of the $x$ and $y$ variables in the order they appear in the formula).

As I understood, in the first case, $x=p$ and $y=(1-p)$, and in the second case $x=(-p)$ and $y=(1-p)$. And he simply wrote the binomial identity $(y+x)^n$, which must be the same as $(x+y)^n$.

And, in the second case, how did he divide the following? $$\sum_{k=0}^n \binom{n}{k}(-p)^k(1-p)^{n-k} = \sum_{k=0}^{\lfloor n/2 \rfloor}\binom{n}{2k}p^{2k}(1-p)^{n-2k} - \sum_{k=0}^{\lfloor n/2 \rfloor}\binom{n}{2k+1}p^{2k+1}(1-p)^{n-(2k+1)}$$

I don't understand how the $(-p)^k$ factor divided into: $p^{2k}$ and $p^{2k+1}$ (two positive $p$). The first factor could make sense because the exponent $2k$ which always yields an even number (i.e. $-1 * -1 = +1$), but it doesn't apply for the second exponent ($2k+1$, always an odd number).