# Conditional probability, who's right?

i need help with a math problem. Me, and at least two teachers have all done it and gotten different results, so now I'm asking the wise people of the internet for help settling the debate.

Here's the problem

"Problem 6

Through a fiber optic cable information is sent in the form of bits, that can have the value of 0 or 1. However there is noise on the line, Such that a sent 0 will with the probability of 1/10 during transmission become changed to a 1.

A sent 1 will with the probability of 1/5 during transmission become a 0. The probability that a randomly selected bit is sent with the value 0 is 2/3

A bit is received with the value 0

a) What is the probability that the received bit was sent with the value 0?

A bit is received with the value 1

b) what is the probability that the received bit was sent with the value 1?"

Current answers are

1. a) = 9/13 and b) = 4/13
2. a) = 9/10 and b) = 4/5
3. a) = 9/10 and b) = 2/5

Which is correct? and why? Thanks in advance for any help.

alright alexis and Zhanxiong here follows the work. the first one is my work and the other two is the work of the teachers. hope it helps :)

also its not multiple choice, ive added the entire problem as written although translated from danish to english.

1)

1. says

P(U0)=2/3 P(U1)=1/3

P(M1|U0)=1/10 P(M0|U0)=9/10

P(M0|U1)=1/5 and P(M1|U1)=4/5

and for b)

and 3)

P(A1)=2/3 P(A2)=1/3

P(B0|A1)=0.9 P(B0|A2)=0.2

P(B1|A1)=0.1 and P(B1|A2)=0.8

for a) P(A1|B0) = (P(B1|A1)P(A1)) / (P(B1|A1)P(A1)+P(B0|A2)P(A2)) which is then (0.9(2/3)) / (0.9(2/3)+0.2(1/3)) = 0.9

and for b) P(A2|B1) = (P(B1|A2)P(A2)) / (P(B1|A1)P(A1)+P(B0|A2)P(A2)) which is then (0.8(1/3)) / (0.9(2/3)+0.2(1/3)) = 0.4

• Please at least show your own working process of how to get option 1. I suspect it was not a debate, but just a multiple-choice problem :) Commented May 8 at 16:41
• Welcome to CV, Azrael. This is a fine question, but please edit it to (a) show your work, and (b) add the self-study tag after reading about what kinds of questions are on topic. Commented May 8 at 16:42
• i've added the work as you asked and added the self-study tag :) Commented May 8 at 17:20

## 3 Answers

A quick simulation of 10M bits in R to confirm the answers given so far:

s <- r <- sample(0:1, 1e7, 1, (2:1)/3)
i <- which(s == 0L)
r[i] <- r[i] + (runif(i) < 0.1)                       # random 0 -> 1
r[-i] <- r[-i] - (runif(length(r) - length(i)) < 0.2) # random 1 -> 0
mean(s[r == 0L] == 0L)                                # P(s = 0 | r = 0)
#> [1] 0.9002982
mean(s[r == 1L] == 1L)                                # P(s = 1 | r = 1)
#> [1] 0.7998291


### Executive Summary

I believe answer 2 is correct in that a) is 0.9 and b) is 0.8.

### Setup

Let $$A$$ be the probability that the sent bit was 0. Thus $$\bar{A}$$ is the probability that the sent bit was 1. Let $$E$$ be the probability that the received bit was switched, and thus is an error.

We are given $$P(A) = \frac{2}{3}$$, $$P(E|A) = 0.1$$, and $$P(E|\bar{A}) = 0.2$$. It is important to note that given this representation, $$P(E|A)$$ also represents the probability of a 1 being received given a 0 was sent and $$P(E|\bar{A})$$ also represents the probability of a 0 being received given a 1 was sent, since they are the probabilities of the bit being switched.

### Part a

For a bit to be $$sent$$ as 0 and $$received$$ as 0, there had to be no error. So we are looking for $$P(\bar{E}|A) = 1 - P(E|A)$$, which is the complement of the given 0.1, or 0.9. This is because we are restricting our universe of possibilities to the case where a 0 was sent.

More formally, we want $$P(\bar{E}|A) = \frac{P(A\cap\bar{E})}{P(A)}$$

as $$P(A\cap\bar{E})$$ is the probability of a 0 being sent and no error, but we must scale for only the cases where a 0 was sent. We know from the law of total probability that $$P(A) = P(A\cap E) + P(A\cap\bar{E})$$.

$$P(E|A) = \frac{P(E\cap A)}{P(A)}\\ 0.1 = \frac{P(E\cap A)}{\frac{2}{3}}\\ P(E\cap A) = \frac{1}{15}\\ P(A \cap\bar{E}) = P(A) - P(A\cap E) = \frac{10}{15} - \frac{1}{15} = \frac{9}{15} = \frac{3}{5} = 0.6\\ \frac{P(A\cap\bar{E})}{P(A)} = \frac{\frac{3}{5}}{\frac{2}{3}} = \frac{9}{10} = \mathbf{0.9}$$

### Part b

For a bit to be $$sent$$ as 1 and $$received$$ as 1, there had to be no error. So we are looking for $$P(\bar{E}|\bar{A}) = 1 - P(E|\bar{A})$$, which is the complement of the given 0.2 or 0.8. This is because we are restricting our universe of possibilities to the case where a 1 was sent.

More formally, we want $$P(\bar{E}|\bar{A}) = \frac{P(\bar{A}\cap\bar{E})}{P(\bar{A})}$$

as $$P(\bar{A}\cap \bar{E})$$ is the probability of a 1 being sent and no error, but we must scale for only the cases where a 1 was sent. We know from the law of total probability that $$P(\bar{A}) = P(\bar{A}\cap E) + P(\bar{A}\cap\bar{E})$$.

$$P(E|\bar{A}) = \frac{P(E\cap \bar{A})}{P(\bar{A})}\\ 0.2 = \frac{P(E\cap \bar{A})}{\frac{1}{3}}\\ P(E\cap \bar{A}) = \frac{1}{15}\\ P(\bar{A} \cap\bar{E}) = P(\bar{A}) - P(\bar{A}\cap E) = \frac{5}{15} - \frac{1}{15} = \frac{4}{15}\\ \frac{P(A\cap\bar{E})}{P(A)} = \frac{\frac{4}{15}}{\frac{1}{3}} = \frac{12}{15} = \mathbf{0.8}$$

What if I said that answer 2) is correct?
Let's look at the known probabilities:
$$P(0\,\mathrm{received}|0\,\mathrm{sent})=9/10$$
$$P(1 received|0 sent)=1/10$$
$$P(1 received|1 sent)=4/5=8/10$$
$$P(0 received|1 sent)=1/5=2/10$$
$$P(0 sent)=2/3$$
$$P(1 sent)=1/3$$

You are now asking what is the probability that a 0 was sent, given that a 0 is received $$=P(0 sent|0 received)$$
We will use Bayes' theorem $$P(0 sent|0 received)=P(0 received|0 sent)*P(0 sent)/P(0 received)=(9/10*2/3)/P(0 received)$$
Now, $$P(0 received)=P(0 sent)* P(0 received|0 sent)+P(1 sent)*P(0 received|1 sent)=2/3*9/10+1/3*2/10=20/30=2/3$$.
Substituting, you get $$P(0 sent|0 received)=9/10$$
Similarly, $$=P(1 sent|1 received)=P(1 received|1 sent)*P(1 sent)/P(1 received)=(4/5*1/3)/P(1 received)=(4/5*1/3)/(1/3*4/5+2/3*1/10)=(4/5*1/3)/1/3=4/5$$.

Now, you do not need to use Bayes' theorem. Let's look at the 4 possible scenarios:
$$P(0 sent ∩ 0 received)=2/3*9/10=18/30$$
$$P(0 sent ∩ 1 received)=2/3*1/10=2/30$$
$$P(1 sent ∩ 1 received)=1/3*4/5=4/15=8/30$$
$$P(1 sent ∩ 0 received)=1/3*1/5=1/15=2/30$$
Now, $$=P(0 sent|0 received)=P(0 sent ∩ 0 received)/P(0 received)=(18/30)/(20/30)=9/10$$ And

$$P(1 \,\mathrm{sent}\vert 1 \,\mathrm{received})={P(1 \,\mathrm{sent} \cap 1 \,\mathrm{received}) \over P(1 \,\mathrm{received})}={8/30 \over 10/30}=4/5$$

Hopefully, the 2 approaches give the same answer...

• I've edited your first line of math so you can see how to add spaces and make text non-italic in mathjax; the former can be done with \, (and a few other commands for spaces of variable widths) and the latter by replacing, e.g., received with \mathrm{received}. Commented May 8 at 21:44
• @jginestet i understand what you are getting at, but the text doesn't say that the probability that a sent 0 is received as a 1 is 1/10 i.e. P(1Received|0Sent)=1/10. It says that the probability that a sent 0 is changed to a 1 is 1/10 which i translate to P(changed|0Sent)=1/10 which makes P(unchanged|0Sent)=9/10, P(changed|1Sent)=1/5 and P(unchanged|1Sent)=4/5. using those we get P(0sent|unchanged)= (P(unchanged|0Sent)*P(0Sent)) / (P(unchanged|0Sent)*P(0Sent)+P(unchanged|1Sent)*P(1Sent)) which is then ((9/10)*(2/3)) / ((9/10)*(2/3)+(4/5)*(1/3)) = 9/13. which seems accurate to the text. Commented May 8 at 23:37
• @jginestet i also ran out of characters before, so sorry if the reply seems a bit standoffish. that's not the intend :) Commented May 8 at 23:38
• @Azrael - your final equation is wrong; it should be, in the last term, P(changed|1 sent), to reflect the fact that you observed a zero, which implies that if 1 was sent, it must have been changed. The two options you actually face - given you've observed a zero - are (unchanged, 0) and (changed, 1). Commented May 9 at 0:06
• I've also fixed your last line so you can see how to offset an equation in its own line and do a prettier version of division, and a couple of other improved format commands (\vert and \cap.) Commented May 9 at 0:13