Conditional Probability Problem (Interview Question)

I've been asked this question on an interview and I'll also share what I answered.

I would like to know if there's anything I haven't thought of?

Problem: The probability of a pet being a dog is 40%. The probability that a pet dog weighs more than 2 kg is 70%. Given a pet is not a dog, the probability of it weighing less than or equal to 2 kg is 70%.

Question: What is the probability of a pet being a dog if it weighs more than 2 kg?

Solution:

(1) P(Pet = Dog) = 0.4

(2) P(Weight > 2 | Pet = Dog) = 0.7

(3) P(Weight ≤ 2 | Pet != Dog) = 0.7

One can obtain the answer by applying Bayes' Rule and the Total Probability Theorem, that is:

P(Pet = Dog | Weight > 2) = P(Pet = Dog, Weight > 2) / P(Weight > 2) = 0.28 / 0.46 = 0.608

Where we get P(Pet = Dog, Weight > 2) = P(Pet = Dog) * P(Weight > 2 | Pet = Dog) = 0.4 * 0.7 = 0.28 from (1) and (2)

Where we get P(Weight > 2) = P(Pet = Dog) * P(Weight > 2 | Pet = Dog) + P(Pet != Dog) * P(Weight > 2 | Pet != Dog) = P(Pet = Dog) * P(Weight > 2 | Pet = Dog) + P(Pet != Dog) * (1 - P(Weight ≤ 2 | Pet != Dog)) = 0.4 * 0.7 + 0.6 * 0.3 = 0.46 from (2) and (3) and applying the Total Probability Theorem.

Thanks for your help!

Posted Aug 28, 2020, 9:35 AM UTC

62
zeta12ti•

Looks alright to me! The only thing I can say is that you should round 0.60869565 up to 0.609 (unless otherwise stated).

1
springuniOP•

Thanks!

1