# Bayes’ Theorem

**Let B _{1}, B_{2}, B_{3}, …, B_{n} be n pairwise mutually exclusive and exhaustive set of events connected to a random experiment E where at least one of B_{1}, B_{2}, B_{3}, …, B_{n} is sure to happen. Let A be an arbitrary event connected to E, where P(A) is not zero. Then,**

\[P({{B}_{i}}|A)=\frac{P({{B}_{i}}).P(A|{{B}_{i}})}{\sum\limits_{i=1}^{n}{[P({{B}_{i}}).P(A|{{B}_{i}})]}}\]

**Proof:**

Here, \[P(A),P({{B}_{i}}),P(A|{{B}_{i}})>0\]

Then we can represent P(A|B_{i}) in two ways,

\[P(A\cap {{B}_{i}})=P({{B}_{i}}).P(A|{{B}_{i}})…………….(i)\]

\[P(A\cap {{B}_{i}})=P(A).P({{B}_{i}}|A)…………….(ii)\]

Now from (i) and (ii) we get,

\[P({{B}_{i}}).P(A|{{B}_{i}})=P(A).P({{B}_{i}}|A)\]

\[\therefore P({{B}_{i}}|A)=\frac{P({{B}_{i}}).P(A|{{B}_{i}})}{P(A)}…………..(iii)\]

Let, S be the sample space of E. Now,

\[A=SA=({{B}_{1}}+{{B}_{2}}+{{B}_{3}}+…+{{B}_{n}})A\]

\[=({{B}_{1}}A+{{B}_{2}}A+{{B}_{3}}A+…+{{B}_{n}}A)\]

Again,

\[({{B}_{i}}A)({{B}_{j}}A)={{B}_{i}}{{B}_{j}}A=\phi A=\phi (i\ne j)\]

So, B_{1}A, B_{2}A, B_{3}A, …, B_{n}A are mutually exclusive

\[\therefore P(A)=\sum\limits_{i=1}^{n}{P(A\cap {{B}_{i}})}\]

\[=\sum\limits_{i=1}^{n}{P({{B}_{i}})}.P(A|{{B}_{i}})\]

[Using law of Total Probability]

Now from (iii) we get,

\[P({{B}_{i}}|A)=\frac{P({{B}_{i}}).P(A|{{B}_{i}})}{\sum\limits_{i=1}^{n}{[P({{B}_{i}}).P(A|{{B}_{i}})]}}\]

**The bag A has 3 white and 2 red balls and another bag B has 4 white and 5 red balls. A bag is chosen randomly and a ball also picked from that bag and seen that the ball picked is red. Find the probability that the bag chosen was B.**

**Solution:**

Let, the events E_{1} = ‘Chosen bag is A’, E_{2 }= ‘Chosen bag is B’ and E = ‘red ball picked’.

Since, Picked ball is red so we have to find P(E_{2}|E).

\[P({{E}_{1}})=\frac{2}{2}=P({{E}_{2}})\]

Again, probability of ‘bag A is chosen and red ball picked’ is

\[P(E|{{E}_{1}})=\frac{2}{5}\]

Similarly,

\[P(E|{{E}_{2}})=\frac{5}{9}\]

Now, from Bayes’ Theorem we have,

\[P({{E}_{2}}|E)=\frac{P({{E}_{2}}).P(E|{{E}_{2}})}{P({{E}_{1}}).P(E|{{E}_{1}})+P({{E}_{2}}).P(E|{{E}_{2}})}\]

\[=\frac{\frac{1}{2}.\frac{5}{9}}{\frac{1}{2}.\frac{2}{5}+\frac{1}{2}.\frac{5}{9}}\]

\[=\frac{\frac{5}{18}}{\frac{1}{5}+\frac{5}{18}}\]

\[=\frac{\frac{5}{18}}{\frac{18+25}{90}}\]

\[=\frac{5}{18}.\frac{90}{43}\]

\[=\frac{25}{43}\]

**A company has two plants to manufacture scooters. Plant X manufactures 70% of scooters and plant Y manufactures 30%. At plant X, 80% of scooters are rated standard quality and at plant Y, 90% of scooters are rated standard quality. A scooter is picked up at random and is found to be of standard quality. What is the chance that it has come from plant X, plant Y?**

Let us define the following events:

H_{1}: scooter is manufactured by plant X

H_{2}: scooter is manufactured by plant Y

A: scooter is rated as standard quality

Then we are given,

\[P({{H}_{1}})=\frac{70}{100}=0.70\]

\[P({{H}_{2}})=\frac{30}{100}=0.30\]

\[P(A/{{H}_{1}})=\frac{80}{100}=0.80\]

\[P(A/{{H}_{2}})=\frac{90}{100}=0.90\]

The probability that scooter comes from plant X is of standard quality is,

\[P({{H}_{1}}/A)=\frac{P({{H}_{1}}).P(A/{{H}_{1}})}{P({{H}_{1}}).P(A/{{H}_{1}})+P({{H}_{2}}).P(A/{{H}_{2}})}\]

\[=\frac{(0.70).(0.80)}{(0.70).(0.80)+(0.30).(0.90)}\]

\[=\frac{56}{83}\]

Similarly,

\[P({{H}_{2}}/A)=\frac{P({{H}_{2}}).P(A/{{H}_{2}})}{P({{H}_{1}}).P(A/{{H}_{1}})+P({{H}_{2}}).P(A/{{H}_{2}})}\]

\[=\frac{(0.30).(0.90)}{(0.70).(0.80)+(0.30).(0.90)}\]

\[=\frac{27}{83}\]

**Consider the clinical test described at the start of this section. Suppose that 1 in 1000 of the population is a carrier of the disease. Suppose also that the probability that a carrier tests negative is 1%, while the probability that a no carrier tests positive is 5%. (A test achieving these values would be regarded as very successful). i)A patient has just had a positive test result. What is the probability that the patient is a carrier? ii)A patient has just had a negative test result. What is the probability that the patient is a carrier?**

Let A be the event ‘the patient is a carrier’, and B the event ‘the test result is positive’. We are given that P(A) = 0.001 (so that P(A^{c}) = 0.999), and that

\[P(B|A)=0.99\]

\[P(B|{{A}^{c}})=0.05\]

i)

\[P(A/B)=\frac{P(A).P(B/A)}{P(A).P(B/A)+P({{A}^{c}}).P(B/{{A}^{c}})}\]

\[=\frac{\text{(0}\text{.001 }\!\!\times\!\!\text{ }0.99\text{)}}{\text{(0}\text{.001 }\!\!\times\!\!\text{ 0}\text{.99)}+\text{(0}\text{.999 }\!\!\times\!\!\text{ 0}\text{.05)}}\]

\[\text{=0}\text{.0194}\]

ii)

\[P(A/{{B}^{c}})=\frac{P(A).P({{B}^{c}}/A)}{P(A).P({{B}^{c}}/A)+P({{A}^{c}}).P({{B}^{c}}/{{A}^{c}})}\]

\[=\frac{\text{(0}\text{.001 }\!\!\times\!\!\text{ }0.001\text{)}}{\text{(0}\text{.001 }\!\!\times\!\!\text{ }0.001\text{)}+\text{(0}\text{.999 }\!\!\times\!\!\text{ 0}\text{.95)}}\]

\[\text{=0}\text{.00001}\]

**2% of the population has a certain blood disease in a serious form; 10% have it in a mild form; and 88% don’t have it at all. A new blood test is developed; the probability of testing positive is 9/10 if the subject has the serious form, 6/10 if the subject has the mild form, and 1/10 if the subject doesn’t have the disease.**

**I have just tested positive. What is the probability that I have the serious form of the disease?**

Let X be ‘has disease in serious form’, Y be ‘has disease in mild form’, and Z be ‘doesn’t have disease’. Let B be ‘test positive’. Then we are given that X, Y, Z form a partition.

**P(X) = 0.02, P(Y) = 0.1, P(Z) = 0.88**

**P(B | X)= 0.9, P(B | Y) = 0.6, P(B | Z) = 0.1**

Thus by the theorem of Total Probability,

\[\text{P(B) = 0}\text{.9 }\!\!\times\!\!\text{ 0}\text{.02 +0}\text{.6 }\!\!\times\!\!\text{ 0}\text{.1 +0}\text{.1 }\!\!\times\!\!\text{ 0}\text{.88 = 0}\text{.166,}\]

and then by Bayes’ Theorem,

\[\text{P(X }\!\!|\!\!\text{ B)=}\frac{P(X).P(B|X)}{P(B)}\]

\[=\frac{0.02\text{ }\!\!\times\!\!\text{ }0.9}{0.166}=0.108\]

;