**Case Study**

In a certain assembly plant, three machines, M_{1}, M_{2}, and M_{3}, make 20%, 30%, and 50%, respectively, of the products. It is known from past experience that 4%, 3%, and 5% of the products made by each machine, respectively, are defective. a) Suppose that a finished product is randomly selected. What is the probability that it is defective? b) If a product were chosen randomly and found to be defective, what is the probability that it was made by machine M_{2}?

Part a) of the simple study case above is a typical problem that can be solved by applying the **total probability theorem** (another name: **elimination rule**). Meanwhile, part b) is a sample problem related to Bayes’ theorem. This post will be talking about the theorems. For this purpose, it is necessary to understand the notion of *partition *of a set.

**Definition**

Let S be a set and K_{1}, K_{2}, K_{3}, …, K_{n} be subsets of S. The sets K_{1}, K_{2}, K_{3}, …, K_{n} are said to form a * partition *of S if the following conditions are satisfied.

**1) K**= S and

_{1}∪ K_{2}∪ K_{3}∪ … ∪ K_{n}**2) K**.

_{i}∩K_{j}= ∅ if i ≠ j

**Example 1**

Let S = {1, 2, 3, 4, 5, 6, 7, 8}, A= {1, 2, 5}, B = {3, 7, 8}, and C = {4, 6}. In this example A, B, and C form a partition of S because the first condition is satisfied: A∪B∪C = S, and so is the second condition: A∩B = Ø, A∩C = Ø, and B∩C = Ø.

**Example 2**

Let S = {1, 2, 3, 4, 5, 6, 7, 8}, A= {1, 2}, B = {3, 7, 8}, and C = {4, 6}. In this example A, B, and C do not form a partition of S because the first condition is violated. A ∪ B ∪ C ≠ S.

**Example 3**

Let S = {1, 2, 3, 4, 5, 6, 7, 8}, A= {1, 2, 5}, B = {3, 7, 8}, and C = {1, 4, 6 }. In this example A, B, and C do not form a partition of S since the second condition is violated. A ∩ C ≠ Ø.

**Theorem of Total Probability (Elimination Rule)**

Let K_{1}, K_{2}, …, K_{n} form a partition of the sample space S and P(K_{j}) ≠ 0 for j = 1, 2, …, n. If A is an event relative to the sample space S then:

………………………………………….. (*)

In the example above, let A = the product is defective, K_{j} = the product is made by machine M_{j}. The sample space is S, i.e. all the products made by the three machines. From all the information provided above, we can write: P(K_{1}) = 0.2, P(K_{2}) = 0.3, P(K_{3}) = 0.5, P(A|K_{1}) = 0.04, P(A|K_{2}) = 0.03, and P(A|K_{3}) = 0.05. To apply the total probability theorem, we must first check whether K_{1}, K_{2}, and K_{3} form a partition of the sample space S. First, note that every product made by the assembly plant must be produced from these machines. So, condition 1) is satisfied. Second, each product is made by one and only one machine among the three available machines. Stated another way, it is impossible for a particular product to be made by more than one machine. Hence, condition 2) is satisfied. In addition, P(K_{1}) ≠ 0, P(K_{2}) ≠ 0, and P(K_{3}) ≠ 0. We have shown that all prerequisites for the validity of (*) are satisfied.

P(A) = P(K_{1}).P(A|K_{1}) + P(K_{2}).P(A|K_{2}) + P(K_{3}).P(A|K_{3})

P(A) = 0.2⋅0.04 + 0.3⋅0.03 + 0.5⋅0.05 = 0.008 + 0.009 + 0.025 = 0.042.

Hence, the probability of selecting a defective product is 0.042. This is the answer to part a).

**Bayes’ Theorem (or Bayes’ Rule)**

Let K_{1}, K_{2}, …, K_{n} form a partition of the sample space S and P(K_{j}) ≠ 0 for j = 1, 2, …, n. If A is an event relative to the sample space S then:

for t = 1, 2, …, n

Note:

The denominator of P(K_{t}|A) above, namely , is none other than P(A), as stated in the Total Probability Theorem.

Now, we will apply Bayes’ Theorem to answer part b). What is sought here is P(K_{2}|A).

Note that P(K_{2})⋅P(A|K_{2}) = 0.3⋅0.03 = 0.009.

Next,

So, the probability that the defective product is made by the M_{2} is **0.2143**.