Learn practical skills, build real-world projects, and advance your career

MA2102

Probability and Statistics

Lecture-8

Total Probability theorem and Baye's theorem

Problem 3: Suppose a calculator manufacturer purchase his IC's(Integrated Circuit board) from supplies $B_1,B_2$ and $B_3$ with 40% from $B_1$, 30% from$B_2$ and 30% from $B_3$. Suppose 1% of supply from $B_1$,5% from $B_2$ and 10% from $B_3$ is defective.
(i) What is the probability that a randomly selected IC from manufacturer stock is defective.
(ii) Suppose a randomly selected IC is found to be defective. What is the probability that it was supplied by supplier $B_{1}$

import matplotlib.pyplot as plt
import matplotlib.patches as patches
fig, ax = plt.subplots(figsize=(12, 6))
ax.set_xlim(0,12)
ax.set_ylim(0,6)
plt.axis('off')
#drawing B1,B2,B3
b1 = patches.Rectangle((0, 0), 4, 6, linewidth=1,edgecolor='b', facecolor="yellow")
b2 = patches.Rectangle((4, 3), 6, 3, linewidth=1,edgecolor='b', facecolor="green")
b3 = patches.Rectangle((4, 0), 6, 3, linewidth=1,edgecolor='b', facecolor="blue")
#drawing D
d = patches.Ellipse((5, 2.7), 3, 2, linewidth=1,edgecolor='b', facecolor=(0.89, 0.30, 0.3, 0.5))
#drawing B1&D, B2&D, B3&D
b1d=patches.Rectangle((10.5, 5), 0.5, 0.5, linewidth=1,edgecolor='b', facecolor=(1, 0.7, 0.0))
b2d=patches.Rectangle((10.5, 3), 0.5, 0.5, linewidth=1,edgecolor='b', facecolor=(0.72, 0.53, 0.04))
b3d=patches.Rectangle((10.5, 1), 0.5, 0.5, linewidth=1,edgecolor='b', facecolor=(0.64, 0.17, 0.89))
ax.add_patch(b1)
ax.add_patch(b2)
ax.add_patch(b3)
ax.add_patch(d)
ax.add_patch(b1d)
ax.add_patch(b2d)
ax.add_patch(b3d)
#adding text labels
ax.text(0.2,5.5,r"$B_1$",fontsize=16)
ax.text(5,5.5,r"$B_2$",fontsize=16)
ax.text(5,0.5,r"$B_3$",fontsize=16)
ax.text(3.85,2.8,r"$D$",fontsize=25)

ax.text(11.1, 5.1,r"$B_1\cap D$",fontsize=16)
ax.text(11.1, 3.1,r"$B_2\cap D$",fontsize=16)
ax.text(11.1, 1.1,r"$B_3\cap D$",fontsize=16)
plt.show()
Notebook Image

solution:
In random experiment of picking an IC from manufacturer's stock. Let Ω\Omega be a sample space (manufacturer stock)
Let BiB_i be the event that selected IC from supplier BiB_i for i=1,2,3i=1,2,3
Here BiBj=B_i\cap B_j=\emptyset for iji\ne j & B1B2B3=ΩB_1\cup B_2 \cup B_3=\Omega (manufacturer stock)
that is B1,B2B_1,B_2 and B3B_3 form a partition for Ω\Omega
Let DD be the event that a randomly selected IC from stock is defective.
Here P(B1)=0.4,P(B2)=P(B3)=0.3P(B_1)=0.4 ,P(B_2)=P(B_3)=0.3
P(D/B1)=0.01,P(D/B2)=0.05,P(D/B3)=0.1P(D/B_1)=0.01 ,P(D/B_2)=0.05 , P(D/B_3)=0.1
(i).
D=D=(DB1)(D\cap B_1)\cup(DB2)(D\cap B_2)\cup(DB3)(D\cap B_3)
Here (DB1),(DB2),(DB3)(D\cap B_1),(D\cap B_2),(D\cap B_3) are mutually exclusive.
P(D)=P((DB1)(DB2)(DB3))P(D)=P((D\cap B_1)\cup(D\cap B_2)\cup(D\cap B_3))

=P(DB1)+P(DB2)+P(DB3)=P(D\cap B_1)+P(D\cap B_2)+P(D\cap B_3) (\because Finite additivity)

=P(D/B1)P(B1)+(D/B2)P(B2)+P(D/B3)P(B3)=P(D/B_1)P(B_1)+(D/B_2)P(B_2)+P(D/B_3)P(B_3) (\because Multiplication theorem)

=(0.01)(0.4)+(0.05)(0.3)+(0.1)(0.3)=0.049=(0.01)(0.4)+(0.05)(0.3)+(0.1)(0.3)=0.049
P(D)=0.049\therefore P(D)=0.049
(ii).
P(B1/D)=P(B1D)P(D)P(B_1/D)=\frac{P(B_1\cap D)}{P(D)}

=P(B1)P(D/B1)P(D)=\frac{P(B_1)P(D/B_1)}{P(D)} (\because Multiplication theorem)

=0.4×0.010.049=0.08163=\frac{0.4\times 0.01}{0.049}=0.08163
P(B1/D)=0.8163\therefore P(B_1/D)=0.8163

Terminology:

  • P(Bi)P(B_i) for i=1,2,3i=1,2,3 are called priori probabilities, because these probabilities are assigned prior to pick an IC and see any evidence(about D),
  • P(Bi/D)P(B_i/D) for i=1,2,3i=1,2,3 are called posterior probabilities, because these probabilities are calculated, after picking and looked at the evidence (that D happened).
  • P(D/Bi)P(D/B_i) for i=1,2,3i=1,2,3 are called likelihood probabilities, because these probabilities indicates likelihood of defectives in each part(supplier)