probability that a random variable is even

Solution 1:

I claim that the answer is $\frac{1}{2}(1+(1-2p)^n)$.

To see why, first of we have to realise what the binomial distribution actually stands for. If an event happens with probability $p$, and we make $n$ trials, then $P(X=k)$ as you defined tells us the chance that we have $k$ "successes", i.e. the chance that the event happens exactly $k$ times. We want to determine the probability that in a process of $n$ trials with success probability $p$, we have an even number of successes. Now lets say that we have performed $n-1$ trials. If we then have an odd number of successes, we will need the last trial to be a success in order for the total number of successes to be even. If the number of successes after $n-1$ trials is already even, then the last event should not be a success. So if we denote by $X_{n,p}$ a random variable with distribution $B(n,p)$, we find:

$P(X_{n,p}\text{ is even})=P(X_{n-1,p}\text{ is odd})*p+P(X_{n-1,p}\text{ is even})*(1-p)$.

Now we are ready to prove the claim, by using induction on n:

For $n=0$, the result should be clear, since then we will always have $0$ (an even number) of successes, hence the chance of $X$ being even is $1$, agreeing with the formula.

Now suppose it holds for $n-1$. Then by the previous result:

\begin{align} P(X_{n,p}\text{ is even}) &=P(X_{n-1,p}\text{ is odd})*p+P(X_{n-1,p}\text{ is even})*(1-p)\\ &=(1-\frac{1}{2}(1+(1-2p)^{n-1}))p+\frac{1}{2}(1+(1-2p)^{n-1})(1-p)\\ &=p-\frac{1}{2}p-\frac{1}{2}p(1-2p)^{n-1}+\frac{1}{2}(1-p)+\frac{1}{2}(1-p)(1-2p)^{n-1}\\ &=p-p+\frac{1}{2}+\frac{1}{2}(1-2p)(1-2p)^{n-1}\\ &=\frac{1}{2}(1+(1-2p)^n). \end{align} Completing the proof.

Solution 2:

Let $X$ denote a discrete random variables taking on nonnegative integer values $0, 1, 2, \ldots$ with probabilities $p_0, p_1, p_2,\ldots$. Then, $$\begin{align} P\{X ~ \text{even}\} &= \sum_{k \geq 0} p_{2k} = p_0 + p_2 + \cdots\\ P\{X ~ \text{odd}\} &= \sum_{k \geq 0} p_{2k+1} = p_1 + p_3 + \cdots\\ \text{Adding and subtracting, we get}\hspace{0.3in}&\\ P\{X ~ \text{even}\} + P\{X ~ \text{odd}\} &= \sum_{k \geq 0} p_k\tag{1}\\ &= 1\\ P\{X ~ \text{even}\} - P\{X ~ \text{odd}\} &= p_0 - p_1 + p_2 - p_3 + \cdots\\ &= \sum_{k \geq 0} (-1)^kp_k\tag{2}. \end{align}$$ For many specific cases of random variables (including Binomial random variables), closed-form expressions can be found for $(2)$. For example, for Poisson random variables $$\sum_{k \geq 0} (-1)^kp_k = \sum_{k \geq 0} (-1)^k e^{-\lambda}\frac{\lambda^k}{k!} = e^{-\lambda}\sum_{k \geq 0}\frac{(-\lambda)^k}{k!} = e^{-2\lambda}\tag{3}$$ allowing us to conclude from $(1)$ and $(2)$ that $$P\{X ~ \text{even}\} = \frac{1+e^{-2\lambda}}{2} = e^{-\lambda}\cosh(\lambda).$$ I will leave the similar calculation for binomial random variables to you as an exercise: the final result works out to be what Uncountable showed.