Showing probability that $A$ and $B$ flip the same number of heads is equal to a total of $k$ heads.

Question: A fair coin is independently flipped $$n$$ times, $$k$$ times by $$A$$ and $$n − k$$ times by $$B$$. Show that the probability that $$A$$ and $$B$$ flip the same number of heads is equal to the probability that there are a total of $$k$$ heads.

I know the probability of getting heads or tails is the same for each because the coin is fair. I also know the probability of an arbitrary number, say, $$m$$ heads is equal to probability of getting $$m$$ tails.

So I know $$P(A$$ gets $$x$$ tails) = $$P(B$$ gets $$x$$ heads)

However, I'm confused as to where to go and how to apply this to the problem. Any help appreciated!

By symmetry we could assume $$k \le n-k$$. The probability that $$A$$ and $$B$$ flip the same number of heads would be $$\sum_{i=0}^{k}{\binom{k}{i}\binom{n-k}{i}(\frac{1}{2})^n} = (\frac{1}{2})^n\sum_{i=0}^{k}{\binom{k}{k-i}\binom{n-k}{i}} = (\frac{1}{2})^n\binom{n}{k}$$, which is exactly the probability to get $$k$$ heads.
The second equation comes from a basic combinatorics formula: Choosing $$k$$ from $$n$$ balls could be done by choosing $$k-i$$ from the first $$k$$ balls and then choosing $$i$$ from the rest $$n-k$$ balls.
• PS: This is called Vandermonde's identity: $$\sum_{i=0}^k\binom mi\binom n{k-i}=\binom{m+n}k$$ Oct 31, 2018 at 2:31