# Difference of two binomial random variables with identical distribution

Is there a closed form answer for absolute value of difference of two identical binomial random variables with identical distributions when $p=1/2$? In particular, what is the the distribution of $|X-Y|$ when $X$ and $Y$ are independent and both $~Bin(n,1/2)$?

• Relevant (general case): math.stackexchange.com/questions/562119/… – Clement C. Jan 23 '17 at 0:48
• I guess that is not a closed form answer as it uses the hypergeomteric function. – Sepehr Jan 23 '17 at 0:49
• No, but it is still relevant for future searches, and having a link here helps in that. (Another one: math.stackexchange.com/questions/1065487/…) – Clement C. Jan 23 '17 at 0:50
• Note that what you want can be rephrased as follows: what is the probability distribution of $\lvert X - n\rvert$, where $X\sim\operatorname{Bin}(2n,\frac{1}{2})$? (I.e., the distribution of the "distance from the mean") – Clement C. Jan 23 '17 at 0:53
• You need to assume your two binomial random variables are independent. – Robert Israel Jan 23 '17 at 1:00

From the various answers at the linked question, it looks as if $$P(|X-Y|=0)={2n \choose n} \frac{1}{2^{2n}}$$ while for positive $z$ $$P(|X-Y|=z)={2n \choose n+z} \frac{1}{2^{2n-1}}$$

• And now I read the second linked question where my answer said in passing "For the case $p=\frac12$, $m-Y$ has the same distribution as $Y$ so $X+Y$ and $X-Y+m$ have the same distribution, which is indeed binomial." $m$ there is $n$ here – Henry Jan 23 '17 at 1:10