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

# Probability and Statistics

### 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.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()

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

$=P(D\cap B_1)+P(D\cap B_2)+P(D\cap B_3)$ ($\because$ Finite additivity)

$=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$
$\therefore P(D)=0.049$
(ii).
$P(B_1/D)=\frac{P(B_1\cap D)}{P(D)}$

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

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

Terminology:

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