# Enumerating cases for conditional probability

I'm trying to find a certain conditional probability by enumerating all the ways the event can occur, and I'm not sure whether or not to include the number of ways in which the event that it is conditioned on can occur.

Specifically, I have a binary communications channel in which each bit has an independent error probability of $e$. I.e., if a bit value $b$ goes into the channel, there is a probability of $1-e$ that a value $b$ will come out, and a probability of $e$ that $\overline{b}$ (not-b) will come out.

Now, if I put 8 bits into the channel, I have event $A$, that exactly 4 of the 8 bits that come out of the channel will have value 1; and I have event $B$, that exactly 4 of the bits that went into the channel had a value of 1.

I want to find $P\left(A|B\right)$.

Here is what I have so far:

Given that $B$ occurs, event $A$ is the disjunction of the following events:

• $A_0$: no errors occurred.
• $A_2$: exactly 2 errors occurred, one which turned a 0 bit into a 1, and one which turned a 1 bit into a 0.
• $A_4$: exactly 4 errors occurred, two of which changed bits from 0 to 1, and two of which changed bits from 1 to 0.
• $A_8$: exactly 8 errors occurred, four of which changed bits from 0 to 1, and four of which changed bits from 1 to 0.

The probability of $A_0$ is easy, it's just $(1-e)^8$.

But the rest are confusing me. Take $A_2$ for instance. The probability of any given double-bit error event is $e^2(1-e)^6$. Given that event $B$ occurred, we know that four of the input bits are 0 and four are 1, so for event $A_2$ to occur (given $B$), We need to pick that one out of the four 0 bits to undergo an error, and (independently) one out of the four 1 bits to undergo an error, so there are $\binom{4}{1} \binom{4}{1} = 16$ different ways to pick the two bits that will undergo an error, out of $\binom{8}{2} = 28$ possible double bit errors. But there are also $\binom{8}{4} = 70$ different ways to choose which of the four inputs bits are 1, and I'm not sure how all this factors in to the probability.

Initially I had $$\mathrm{P}\left(A_2 | B\right) = e^2(1-e)^6 \frac{ \binom{4}{1}\binom{4}{1} }{ \binom{8}{2} }$$

But do I need to include the $\binom{8}{4}$ in there? And then is the probability of $A$ given $B$ just the sum of probabilities of $A_0$, $A_2$, etc., or does the $\binom{8}{4}$ need to factor into that somehow?

-

We do your case $A_2$. The others will be similar.

For visualization (it makes no difference) it is easiest to imagine that the first four input bits are $0$, and the last $4$ are $1$.

The $0$ bit that got changed can be chosen in $\binom{4}{1}$ ways. The probability this bit got changed and the other three didn't is $e(1-e)^3$. The $1$ bit that got changed can be chosen in $\binom{4}{1}$ ways. The probability this bit got changed and the others didn't is $e(1-e)^3$.

Thus given that there are four $0$ bits and four $1$ bits, the probability that two of the bits get changed with no change in the counts is $\binom{4}{1}^2e^2(1-e)^6$.

The cases $A_4$, $A_6$, $A_8$ are done in essentially the same way.

-
Thanks. That's nearly what I came up with as described in the question, but it is not any more clear to me why you don't need $\binom{8}{4}$ included somewhere as this is the total number of ways in which you can choose which four bits are set and which four are cleared. – sh1ftst0rm Feb 19 '14 at 13:42
If you do a formal probability calculation. Let $a$ be the conditional probability of our event given certain a certain $4$ bits are set. To find the probability of our event, we multiply and divide by the probability those bits are set, which changes nothing. – André Nicolas Feb 19 '14 at 14:31