If a fair coin is thrown six times. Let $X =$ number of heads and $Y = 6-X =$ number of tails. What is $E|X-Y|?$
I was able to come up with this table, but I am not sure if this is correct or not and how to proceed from here?
If a fair coin is thrown six times. Let $X =$ number of heads and $Y = 6-X =$ number of tails. What is $E|X-Y|?$
I was able to come up with this table, but I am not sure if this is correct or not and how to proceed from here?
Copyright © 2021 JogjaFile Inc.

You could find the joint distribution of $X$ and $Y$, and use that for the computation. However, it is less work to note that $|X-Y|=|2X-6|$. For each of the $7$ possible values $k$ of $X$, find $\Pr(X=k)$. Then our expectation is $$\sum_{k=0}^6 |2k-6|\Pr(X=k).$$ We start. For $k=0$, the probability is $\frac{1}{2^6}$, and $|2k-6|=6$. That gives a contribution of $\frac{6}{2^6}$ to the expectation. And $k=6$ gives precisely the same contribution, another $\frac{6}{2^6}$.
Look now at $k=1$. The probability is $\frac{6}{2^6}$, and the value of $|2k-6|$ is $4$, for a contribution of $\frac{24}{2^6}$.
Continue. Might as well do $k=5$ next. At the end, add up.
Another way: Let $W=|2X-6|$. We find the distribution function of $W$, and then compute the expectation in the usual way. Note that $W$ can only take on the value $6$, $4$, $2$, and $0$. Now calculate. By the reasoning we used above, we have $\Pr(W=6)=\frac{2}{2^6}$, and $\Pr(W=4)=\frac{12}{2^6}$, and so on.