Amazon Interview Question
AnalystsCountry: United States
Interview Type: Phone Interview
Actually the question was probability of defective given the test result was defective. P(defective/identified defective) = P(identified defective/defective)*P(defective)/P(identified defective) = (1*0.6)/(1*0.6 + 0.02*0.4) = 0.987 (approx).
Here is how I understand the question:
0.6% or 6 out of 1000 are actually defect.
2% or 20 out of 1000 are declared defect, but they are not defect.
Meaning out of 1000, 26 would be declared defect.
Now the Question:
Given that a randomly chosen transistor is declared defective by the
tester, compute the probability that it is actually defective.
26 out of my 1000 would be declared defective, but only 6 are
actually defective.
The chances that the transistor chosen is defective is
6 out of 26 = 0.2308 or 23.08%
In other words that would not be a very efficient test. Roughly
three out of four transistors that are thrown out, are not
defective.
This is a simple conditional probability problem of the form P(A | B) or the probability that A happens given B has already happened. In this case A is the event that the transistor is defective and B is the event of a positive test.
P(A) = probability that the transistor is defective = 0.6
P(B) = probability that the test is positive
= probability that a defective transistor tests positive + probability that a good transistor tests positive
= probability that a transistor is defective * probability test is positive + probability that a transistor is good * probability of a test is positive
= 0.6*1 + 0.4*0.02
= 0.608
P(A | B) = P(A intersect B) / P(B) = 0.6 / 0.608 = 0.986
The probability can be found out as:
Consider there are 1000 transistors. Out of those 6 are defective that is 994 are good transistors. Now as 2 transistors are mis-identified as defective in 100 transistors. So number of transistors misidentified in 994 good transistors are - (2*994)/100=19.88. So in total defective transistors 6+19.88=25.88. So probability it is actually defective is 6/25.88=0.232
This is an incorrectly designed problem. The interviewer tries to ask the capability to handle conditional probability properly. This seemingly witty question can be resolved only when two events A: "Transistor is defective" B: "Test shows defective" are independent; In English, "test" is ineffective and it actually has no reliability to test the transistor's defectiveness. Otherwise, the probability of the intersection of two events cannot be expressed in the form of product of each event probability.
If the interviewer changed the question as follows, then the other people's suggested answers are correct.
"A bag contains many red or blue colored transistors. Among them 0.6% are defective. In every 100 non-defective transistors, two are red. You randomly pick one transistor and it turns out to be red. What is the probability that it is defective?"
Do you see the difference?
Prob. of actually defective = prob of defective / (prob of defective + prob of good misidentified as defective)
- mitruka.abhishek July 29, 2013prob of good misidentified as defective = prob of good * 2 / 100
= 0.006 / (0.006 + 0.994 * 0.02) = 0.006 / (0.006 + 0.01988)
= 0.232