Condition for probability of even number heads to be $1/2$ Suppose we flip $n$ coins (each flip is independent, but not necessarily identically distributed). Under what conditions will the probability that we flip an even number of heads be exactly $1/2$?
I know that when all the coins are fair, then the probability is half (see e.g. this thread). But I'm not sure how to handle the case if the coins aren't fair.
 A: Pick a coin, suppose it comes up heads with probability $p$. Suppose the other $n-1$ coins give an even number of heads with probability $q$. Then we need
$$p(1-q)+(1-p)q=\frac{1}{2}\implies p+q-2pq=\frac{1}{2}\implies(2p-1)(2q-1)=0.$$
So either $p=\frac{1}{2}$ or $q=\frac{1}{2}$. Inducting downwards implies that the probability of an even number of heads is $\frac{1}{2}$ iff at least one of the coins is fair.
A: I like jlammy's solution. Here's an alternative proof without induction.
Denote $p_i, q_i$ the probability of the $i^{th}$ coin getting a head or tail, respectively. Then $p_i+q_i=1$. Consider the following product:
$$T=(q_1-p_1) (q_2 -p_2) \cdots (q_n - p_n) = P-M \tag 1$$
where $P$ is the sum of all positive terms after expansion, and $M$ is the absolute value of the sum of all negative terms. Then $P$ is the probability of getting an even number of heads, $M$ is the probability of getting an odd number of heads, and $P+M=1$. Therefore,
$$P=M = \frac 12 \iff T=0  \iff p_i=q_i=\frac 12, \text{ for some }i. \blacksquare$$
