# Bayes theorem on the probability of an object drawn at random using percentages (not Naive Bayes)

It's the normal Bayes equation but I'm not sure if I've calculated this correctly or how to check my work, here is a somewhat similar question but I wasn't sure if our math was the same, the question was a little more complex, here's my question:

A company has four machines that manufacture levers for cars, machines M1, M2, M3 and M4 manufactures 10%, 25%, 25% and 40% of the levers respectively. Of their outputs 10,15,20,and 2 percent respectively are defective levers. You draw a lever at random during inspection from the product bin and you find it to be defective. What is the probability that it was manufactured by machine M2? Derive the Bayes (not Naive Bayes) formulation from the conditional probability after listening to the lecture.

Here's my work:

m1 = 10%; defective output 10%
m2 = 25%; defective output 15%
m3 = 25%; defective output 20%
m4 = 40%; defective output 2%

m1 = 1/10; 1/10 defective
m2 = 1/4; 3/20 defective
m3 = 1/4; 1/5 defective
m4 = 2/5; 1/50 defective

  1/4  * [(3/20)/(1/4)]
------------------------
+ 1/10 * [(1/10)/(1/10)]
+ 1/4  * [(3/20)/(1/4)]
+ 1/4  * [(1/5)/(1/4)]
+ 2/5  * [(1/50)/(2/5)]

  .25  * [(.15)/(.25)]
------------------------
+ .10  * [(.10)/(.10)]
+ .25  * [(.15)/(.25)]
+ .25  * [(.2)/(.25)]
+ .40  * [(.02)/(.40)]

.15
-----
.10+.15+.2+.02

.15
-----
0.47

15/47 = 0.319148936
~32%


This is the example in the textbook I'm basing my work on, I've highlighted some things for clarity, the example doesn't use percentages and is more simplified:

Perhaps I am missing something, but isn't it as follows?

Probability of drawing a lever from a specific machine value
$$p\left(M_1\right)$$ 10/100
$$p\left(M_2\right)$$ 25/100
$$p\left(M_3\right)$$ 25/100
$$p\left(M_4\right)$$ 40/100

And

Probability of faulty lever given machine value
$$p\left(F|M_1\right)$$ 10/100
$$p\left(F|M_2\right)$$ 15/100
$$p\left(F|M_3\right)$$ 20/100
$$p\left(F|M_4\right)$$ 2/100

Probability of machine 2, given faulty is then:

$$p\left(M_2|F\right)=\frac{p\left(F|M_2\right)\cdot p\left(M_2\right)}{p\left(F\right)}=\frac{p\left(F|M_2\right)\cdot p\left(M_2\right)}{\sum_k p\left(F|M_k\right)\cdot \left(M_k\right)}\approx0.355\dots$$

• so that equation would be 0.15 * 0.25 / (.10 * .10) + (0.15 * 0.25) + (0.20 * 0.25) + (0.02 * 0.40) or 0.0375 / (0.01 + 0.0375 + 0.05 + 0.008) which is 0.0375/0.1055 = 0.35545 okay yeah I think I got it, thanks! Oct 20 at 1:30