It may be the wording of the question, but I'm not sure how to go about doing this. This is not a homework question I just want to know if my answer is correct. *Please note the wording is confusing, but please interpret however you understand.

90% of candidates to a job position can code both in Python and Perl. 70% of these candidates can code in Python and 50% can code in Perl. What is the probability that a candidate can code in Perl knowing that he can code in Python?'

The way I interpreted this was that the probability that a candidate can code in both is 20% (is this assumption correct?) In the end I found that the answer is 2/7.

If someone can verify this I would be very thankful, as I'm not sure I went about it the right way!

• The question appears to be inaccurately worded. "90% of candidates to a job position can code both in Python and Perl" should probably be written "90% of candidates to a job position can code in either Python and Perl".
– mkt
Dec 21, 2017 at 20:20
• The question is not correct. Dec 21, 2017 at 20:21
• I agree the wording is confusing. I'm not sure how to interpret it actually, I took it as can code *either Python or Perl but not sure if this is correct. Please interpret however you understand Dec 21, 2017 at 20:25

I assume that by writing

90% of candidates to a job position can code both in Python and Perl

they actually meant "can code either in Python or Perl". This is consistent with the rest of the question, as they divide this quantity further into Perl-coders and Python-coders.

In such questions, it helps to denote the variables. Let's denote by $A$ the event that a person knows Python and by $B$ the event that a person knows Perl. Now, in the question we are given the following quantities: $$P\left(A \cup B\right) = 0.9 \\ P\left(A \mid A \cup B\right) = 0.7 \\ P\left(B \mid A \cup B\right) = 0.5$$

And our final goal is to calculate $P\left(A\mid B\right)$.

Now, this question consists of multiple steps. You don't need to assume anything since you have enough data. You need to first calculate $P\left(A\right)$, $P\left(B\right)$, then calculate $P\left(A \cap B\right)$, and only then you can calculate $P\left(A \mid B\right)$. The following identifies might be helpful: $$P\left(A \cup B\right) = P\left(A\right) + P\left(B\right) - P\left(A \cap B\right) \\ P\left(A \mid B\right) = \frac{P\left(A \cap B\right)}{P\left( B\right)}$$

The final result should be $P\left(A \mid B\right) = 0.4$

• Thank you so much!! I am so impressed that you were able to break this down so clearly. I am hoping to be able to do this one day. How did you learn? Is there anything you recommend doing to learn to solve these comfortably? Dec 21, 2017 at 21:03
• I think it mainly comes with practice. Pick up a textbook and try to solve questions without skipping steps. I recommend "A First Course in Probability" by Sheldon Ross (it has many question on each topic). If you miss some of the theory as well, the book could be a great refreshment/study guide. Dec 21, 2017 at 21:38