xyz Interview Question
Data ScientistsCountry: United States
Interview Type: Phone Interview
68% is correct but the solution is not.
The correct solution is:
A - first chip is good;
B - second chip is good.
What we have to find is a conditional probability p(B/A) which is
p(B/A)= p(AB) / p(A).
Let's designate:
p1 - is probability to get a good chip from the first vendor.
p2 - is probability to get a good chip from the second vendor.
p(AB) = 0.5*p1*p1 + 0.5*p2*p2
p(A) = 0.5*p1 + 0.5*p2
So
p(B/A) = (p1*p1 + p2*p2)/(p1 + p2).
Example: p1 = 0.8; p2 = 0.2
p(B/A)=0.68
I didn't answer this one correctly, but the interviewer helped me. So, if we know that probability to get good chip from good company is 0.8 and from bad company is 0.2, and first chip in the pack is good, it translates to the probability of the second chip to be good 0.8*0.8=0.64 (if pack came from the good company), and 0.2*0.2=0.04 (if pack came from the bad company). And total probability that the second chip in the pack is good is a sum of both probabilities: 0.8*0.8 + 0.2*0.2 = 0.64+0.04 = 0.68 , or 68%.
According to probability tree the branch is as below
Bad_company-->Good chip-->Good chip
That means 1/2 * p(Good chip) * p(Good chip)
Now as the company is a bad company p(Good chip) can never be 1. Otherwise it would never be a bad company. That means the probability is less than 1/2 i.e. less than 50%
Sorry I was wrong
It should be
According to probability tree the branch is as below
Bad_company-->Good chip-->Good chip + Good_company-->Good chip-->Good chip
That means probability is
1/2 * pBad(Good chip) * pBad(Good chip) + 1/2 * pGood(Good chip)*pGood(Good chip)
Now as the company is a bad company pBad(Good chip) can never be 1. Otherwise it would never be a bad company.
Again pGood(Good chip) is always more than pBad(Good chip).
Now the answer will come accordingly.
I post my solution made with tree diagram
--->(branch 1) Good Company, 0.5 ---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2
----> (branch 2) Bad Company, 0.5 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8
After we discovered that we got first chips that is good, we can make another probability tree for the aposterior event. However, now probability that we choose a Good company is higher, given the fact that the first chips is good. What is the P(Good Company|Good Chips)?
P(Good Company|Good Chips) = P(Good Company and Good Chips)/P(Good Chips) = (we read values from the upper tree) = 0.8*0.5/(0.8*0.5+0.5*0.2) = 0.8
Given the fact that the first chips is good, now we have 0.8 chance that we chose a good company. So we have another aposterior tree:
--->(branch 1) Good Company, 0.8---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2
----> (branch 2) Bad Company, 0.2 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8
We finaly compute from the tree P(Good Chips) = P(Good Chips and Good Company) + P(Good Chips and Bad Company) = 0.8*0.8 + 0.2*0.2 = 0.64
I post my solution made with tree diagram
--->(branch 1) Good Company, 0.5 ---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2
----> (branch 2) Bad Company, 0.5 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8
After we discovered that we got first chips that is good, we can make another probability tree for the aposterior event. However, now probability that we choose a Good company is higher, given the fact that the first chips is good. What is the P(Good Company|Good Chips)?
P(Good Company|Good Chips) = P(Good Company and Good Chips)/P(Good Chips) = (we read values from the upper tree) = 0.8*0.5/(0.8*0.5+0.5*0.2) = 0.8
Given the fact that the first chips is good, now we have 0.8 chance that we chose a good company. So we have another aposterior tree:
--->(branch 1) Good Company, 0.8---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2
----> (branch 2) Bad Company, 0.2 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8
We finaly compute from the tree P(Good Chips) = P(Good Chips and Good Company) + P(Good Chips and Bad Company) = 0.8*0.8 + 0.2*0.2 = 0.64
I post my solution made with tree diagrams
--->(branch 1) Good Company, 0.5 ---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2
----> (branch 2) Bad Company, 0.5 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8
After we discovered that we got chips that is good, we can make another probability tree for the aposterior event. However, for the new tree, probability that we choose a Good company is higher, given the fact that the first chips is good. What is the P(Good Company|Good Chips)?
P(Good Company|Good Chips) = P(Good Company and Good Chips)/P(Good Chips) = (we read values from the upper tree) = 0.8*0.5/(0.8*0.5+0.5*0.2) = 0.8
Given the fact that the first chips is good, now we have 0.8 chance that we chose a good company. So we have another aposterior tree:
--->(branch 1) Good Company, 0.8---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2
----> (branch 2) Bad Company, 0.2 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8
We finally compute from the tree P(Good Chips) = P(Good Chips and Good Company) + P(Good Chips and Bad Company) = 0.8*0.8 + 0.2*0.2 = 0.68
Both chips are coming from the same either good or bad company. Doesn't it mean if first chip is good then second ship is also good since its from same company?
Thus probability should be 100%
No the question is poorly worded. The "good" company does not make 100% "good" chips and the "bad" company does not make 100% failing chips. A good company has a chance of making bad chips. By saying the "first chip in the pack is good", he does not mean from the "good" company but he mean good as in it is not a failing chip.
This question is so poorly written and thus misleading. The most important information is hidden behind the ambiguous wording of the question.
- Hi March 03, 2016