Probabilistic Livestock Testing

A farmer is testing a new piece of equipment he has for determining whether an animal is a cow or a sheep. If a cow walks through the machine, 90% of the time it says it is a cow and 10% of the time it says it is a sheep. If a sheep walks through the machine, 95% of the time it says it is a sheep and 5% of the time it says it is a cow. The farmer has 5 cows and 36 sheep. If an animal walks through and the machine claims it is a cow, the probability that it actually is a cow can be expressed as a b \frac{a}{b} where a a and b b are coprime numbers. What is a + b a + b ?


The answer is 12.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

10 solutions

Justin Yu
May 20, 2014

We know the animal selected is actually a cow or a sheep. So, we split this into two cases. Case 1: It is actually a cow. There are 5 cows out of 41 animals, and a 90% chance that the cow will be tested positive as a cow, so the probability that a cow chosen and is tested positive is 5 41 0.9 = 4.5 41 \frac {5}{41} \cdot 0.9 =\frac {4.5}{41}

Case 2: It is actually a sheep. There are 36 sheep out of 41 animals, and a 5% chance it gets tested positive as a cow, so this probability is 36 41 0.05 = 1.8 41 \frac {36}{41} \cdot 0.05 = \frac{1.8}{41}

Thus, the probability it is actually a cow is 4.5 41 4.5 41 + 1.8 41 = 5 / 7 \frac {\frac {4.5}{41}}{\frac {4.5}{41} + \frac{1.8}{41}}=5/7 , so our answer is 5+7=12

This is a standard application of Bayes rule in conditional probability. Due to the low incidence of cows, the probability that the animal is indeed a cow is only approximately 70 % 70\% .

A real-world application of this problem, is the issue 'false positives paradox' in medical tests. If the incidence of a disease is extremely low, and we only have a probabilistic test, then there will be more of those who test positive but do not have the disease, than those who test positive and actually have the disease.

Calvin Lin Staff - 7 years ago
Shivang Jindal
May 20, 2014

There are two ways for the machine to think that the animal is a cow: The animal is a cow and the machine is correct. This occurs with probability of 5 41 × 90 % \frac{5}{41} \times 90\% The animal is a sheep and the machine is incorrect. This occurs with probability of 36 41 × 5 % \frac{36}{41} \times 5\%

The above calculations sum together cover every case where the machine thinks that it is a cow. Clearly, we need the first one to be correct, so that part is the numerator.

Our computed probability is

5 41 × 90 % 5 41 × 90 % + 36 41 × 5 % \frac{\frac{5}{41} \times 90\%}{\frac{5}{41} \times 90\%+\frac{36}{41} \times 5\%} = 5 7 =\frac{5}{7}

Our answer is 5 + 7 = 12 5+7=\boxed{12}

total number of animals = 5(cows) + 36(sheep) =41

probability of machine claiming the animal to be cow = (5/41) (90/100) + (36/41) (5/100)

probability of it actually being cow = {(5/41) (90/100)} / {(5/41) *(90/100) + (36/41) (5/100)}

on simplifying it gives = 90/126 = 5/7

therefore answer = 12

Vignesh Sundaram
May 20, 2014

There are two cases here. first is that a cow walks in and its condition is 5 and the machine predicts it correctly, Second case is that a sheep walks in and the machine predicts it wrong. The two cases constitute the universal set for this conditional case. The case favoring us is that a cow walks in and the machine predicts it correctly. so the probability is (5 0.9)/(5 0.9+36*0.05 ) = 45/63 =5/7 in the reduced form. so a=5 and b=7. a+b=5+7=12.

Sagar Agarwal
May 20, 2014

Probability of a cow =5/41

Probablity of a sheep=36/41

Probability of being a cow by machine is =(5/41)*9/10+x

x= =Probability of being not a sheep by machine that is actually a sheep=(36/41)*5/100

Therefore,Probability of being a cow by machine is =(5/41) 9/10+(36/41) 5/100

Probability that it is actually a cow =((5/41) (9/10))/((36/41) 5/100+(5/41)*9/10)

Hence answer =5/7 a=5 b=7 a+b=12

Jp Delavin
May 20, 2014

Let A A be the event that a cow walks through the machine, A c A^c be the event that a sheep walks through the machine, B B be the event that the machine claims that an animal is a cow, and B c B^c be the event that the machine claims that an animal is a sheep. The desired probability is P ( A B ) P(A|B) .

P ( A B ) = P ( A B ) P ( B ) P(A|B)=\frac{P(A \cap B)}{P(B)}

P ( A B ) = P ( B A ) P ( A ) P ( B A ) P ( A ) + P ( B A c ) P ( A c ) P(A|B)=\frac{P(B|A)P(A)}{P(B|A)P(A)+P(B|A^c)P(A^c)}

P ( A B ) = 0.9 5 5 + 36 0.9 5 5 + 36 + 0.05 36 5 + 36 P(A|B)=\displaystyle\frac{0.9\cdot\frac{5}{5+36}}{0.9\cdot\frac{5}{5+36}+0.05\cdot\frac{36}{5+36}}

P ( A B ) = 5 7 P(A|B)=\frac{5}{7}

Thus, a + b = 12 a+b=12 .

Calvin Lin Staff
May 13, 2014

Solution 1:

The probability that a cow walks through the machine is 5 41 \frac{5}{41} . So the probability that the machine says cow is 0.9 5 41 + 0.05 36 41 = 0.9 ( 5 ) + 0.05 ( 36 ) 41 0.9\cdot \frac{5}{41} + 0.05\cdot \frac{36}{41} = \frac{0.9(5) + 0.05(36)}{41} . The chance that a cow walks through the machine and the machine says cow is 0.9 5 41 0.9\cdot \frac{5}{41} , so the probability that it is actually a cow is . 9 ( 5 ) 41 . 9 ( 5 ) + . 05 ( 36 ) 41 = . 9 ( 5 ) . 9 ( 5 ) + . 05 ( 36 ) = 5 7 . \frac{\frac{.9(5)}{41}}{\frac{.9(5)+.05(36)}{41}} = \frac{.9(5)}{.9(5)+.05(36)} = \frac{5}{7}. So a + b = 5 + 7 = 12 a + b = 5 + 7 = 12 .

Solution 2: This is a simple application of Bayes Rule. Let A A be the event that a cow walks through the machine. Let B B be the event that the machine claims the animal is a cow. P ( A ) = 5 41 P(A) = \frac{5}{41} and P ( B ) = 5 41 9 10 + 36 41 1 20 = 126 820 = 63 410 P(B) = \frac{5}{41}\cdot \frac{9}{10} + \frac{36}{41}\cdot \frac{1}{20} = \frac{126}{820} = \frac{63}{410} and P ( B A ) = 9 10 P(B|A) = \frac{9}{10} . So P ( A B ) = P ( B A ) P ( A ) P ( B ) = 9 10 5 41 410 63 = 45 63 = 5 7 P(A|B) = \frac{P(B|A)P(A)}{P(B)} = \frac{9}{10}\cdot \frac{5}{41}\cdot \frac{410}{63} = \frac{45}{63} = \frac{5}{7} . So a + b = 5 + 7 = 12 a + b = 5 + 7 = 12 .

Aryan Mehra
Oct 9, 2016

Use simple Bayes theorem

I drew a table comparing what the animals are and what the machine claims them to be. Since it claims it's a cow, we see that 1.8 sheep would be tested as a cow and 4.5 cows would be tested as a cow. Therefore, 4.5 / 1.8 + 4.5 = 5/7.

Ady Tzidon
Sep 5, 2015

a/b=45/(45+18)=45/83=5/7..............a+b=12

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...