Thursday, February 20, 2020

On the Licking of Frogs


Abstract

A popular math puzzle, presented in a viral video by Ted-Ed contributor Derek Abbott, involves a poisoned hero with a chance for survival hinging on licking frogs that may or may not be covered in antidote. Only female frogs have the antidote, only males croak. You can pick between a single, silent frog or a pair of frogs where you have heard one of them croak. Which option should you take? 

An intuitive answer is that it doesn’t matter which option you pick, since in the first case you have one unopened lottery ticket and in the second case you also have one unopened lottery ticket, plus one meaningless, opened, losing lottery ticket that can be thrown away. If asked for the survival chance an intuitive guess might be 50%, because the chance of any random frog being female is 50%. 

The Ted-Ed presentation suggests a different answer, in which the chance of the single frog being female is 50% but the chance of finding a female in the pair is 67%. It’s better to pick the pair! 

Popular Mechanics, in an article referencing the Ted-Ed presentation, goes on to add a surprising twist. They say that if you happen to see which frog in the pair croaked, the survival rate collapses from 67% down to 50%, matching that of the single frog.

As we will see, both Ted-Ed and Popular Mechanics are mistaken.

Interestingly, and perhaps a bit uncharacteristically for popular probability puzzles, for once the intuitive answer is mostly correct in that it really doesn't matter if you pick the single frog or the pair, the lottery ticket analogy checks out. Even the intuitive estimate of a 50% survival rate is roughly correct, at least given the reasonable assumption that frogs don't croak too often. Nevertheless, the estimate is ultimately conservative in that 50% is only the worst case scenario, survival rates approaching 100% are on the table all depending on how often male frogs croak. 

In this presentation we will use Bayes theorem to prove that it doesn’t matter which option you pick, and that the survival rate can be calculated as a function of the male croaking rate f as follows.


Problem Statement

The following quote is taken from the referenced Popular Mechanics article.
All rights to the following quoted text belong to Popular Mechanics.
“You are lost in the jungles of Brazil. After days of wandering, your food supplies dwindle, and you make a fatal mistake by eating a poisonous mushroom. You can feel the poison coursing through your veins, sure that you will collapse any second.
But there is hope. The antidote to the poison is secreted by a certain species of frog found in this rainforest, and you can save yourself by licking one of these frogs. But, only the female frogs secret the antidote you need. The male and female frogs look identical, and they occur in equal numbers across the population. The only distinguishing feature is that the male frogs have a unique croak.
As your vision starts to blur, you look up and see one of these frogs sitting on a stump in front of you. You are about to make a mad dash to the frog, praying that it is female, when you hear the male frog's distinctive croak behind you. You turn around and see that there are two frogs on the grass in a clearing, just about as far away from you as the one on the stump. You do not know which one of the two frogs in the clearing croaked.
You only have time to reach the one frog on the stump, or the two frogs in the clearing (one of which croaked) before you pass out. Should you dash to the stump and lick the one frog, or into the clearing and lick the two?”


Solution





Objective

The objective of this presentation will be to demonstrate:
·         The survival rate with the single frog and the frog pair will be exactly the same.
·         The survival rate depends on the male frog croaking frequency and is described by:


A Meaningless Choice

The first thing to note is that it cannot matter which option you pick, the single frog or the pair. It stands to reason that in both cases you have exactly one frog to pin your hopes on, since one frog in the pair is known to be male.
The chance that the silent frog in the pair is female is exactly the same as the chance that the silent frog on the tree stump is female – having a croaking neighbor does not impact its chances of being female since all the croaking proves is that the neighbor is male and having a male neighbor does not impact a frog’s chances of being male or female. With both options, single frog or pair, you rely on the chance that a single, silent frog is female.
If we were to use unconditional probability, not taking the frogs’ silence into account, this would mean our survival chance with either option, single frog or pair, would be exactly that of one random frog being female, which is 50%.
Using conditional probability we would take the silence into account and get a slightly different (better) answer, but it would still be the same survival rate for the single frog and the pair, because in both cases we are asking the same question: what is the probability that a single frog is female, given that it is silent?
It should be clear that the croaking of a neighbor would have no impact on the likelihood that a silent frog is female, but to show that this argument is correct a proof will be included below, wherein it is shown that the survival rate for the single frog and the survival rate for the frog pair is described by the same function.

Croaking Frequency Matters

The second thing to note is that the survival rate depends on the croaking frequency of the male frog. It is easy to see that this must be the case when considering a 100% chance that a male frog croaks in the relevant time span (the time from when we start listening to when we make our decision about what direction to run in). In this case, a frog that doesn’t croak must be female, and survival rate spikes to 100% for both the single, silent frog and the pair (which also contains one silent frog).
Conversely, if the croaking frequency is very low, the silence from the single frog and the silent partner in the pair tells us almost nothing about their chances of being male or female. Our survival chances drop drastically for the single frog and the pair alike, approaching 50% (that of one random frog being female) as the croaking frequency falls towards zero.
So survival rate must be a function of a male frog croaking frequency f (given as a value between 0 and 1 meaning 0% to 100%) resulting in survival rates between 50% and 100%.  
Could it be a linear function? If so, a croaking frequency of 50% ought to yield a survival rate of 75%.
We can test (and disprove) that idea by using a simple box counting experiment as a model to determine the chances that the single, silent frog on the tree stump is female.
Take 100 boxes and place a random frog in each box. 50 boxes (roughly) will contain a male frog and 50 will contain a female frog. Assume a male frog croaking frequency of two hours and listen to the boxes for one hour (f = 0.5). When you hear a croak from a box you mark the box. After one hour you should have roughly 25 marked boxes. If you are now given one of the unmarked boxes, what are the chances that it contains a female? There are 75 unmarked boxes, 50 of them contain a female and 25 contain a male, so the chance of getting a female in an unmarked box is two out of three or 67%.
So the survival rate for the single frog option given a 50% male frog croaking chance is 67%, not 75%. This tells us that the survival rate given isn’t just a linear function and that we need to start looking for another function that can give us the survival rate for any f between 0 and 1.
We can use Bayes' theorem to find this function for both options, the single frog and the pair of frogs. If the functions turn out to be the same, we will also have proven that the choice between the single frog and the pair doesn’t matter, as the argument outlined above would seem to indicate.

Proof

In this proof we will use Bayes' theorem to derive the survival rate as a function of male frog croaking frequency, first for the single frog and then for the frog pair. When both alternatives yield the same function, it will be considered proven that it doesn’t matter if you pick the single frog or the frog pair.
Bayes' theorem


We let the symbol f stand for the male frog croaking frequency and be synonymous to P[croak|malewhich represents the probability of a croak given a male frog.




Single Frog Survival Rate

The survival rate when picking the single frog is equivalent to the probability that it is a female frog. Using unconditional probability, the survival rate would simply equal P[female] = 50%. Using conditional probability the question that determines survival rate becomes: what is the chance that the single frog is female given that it hasn’t croaked?



We use Bayes’ theorem to calculate the probability that the frog is female given its silence.


The probability that a random frog is female, as per the problem description, is 50% and the same goes for the probability that it is male.






The probability of silence given a female frog must be 1 since the females never croak.





Plugging in the values we have listed we get the following.





The probability that a random frog is silent, represented by P[silence], is the complement of its chance to croak.



The chance that a random frog croaks is given by the chance that it is male multiplied by the chance that a male frog croaks.



This takes us to the following formula.




We multiply each term with two to simplify it, giving us the following function.






Frog Pair Survival Rate

The survival rate when picking the frog pair is the complement to the probability that it contains two male frogs given that we have heard one croak. If the pair contains two males we die, in all other cases (which include male/female and female/male but not female/female since we have heard one croak) we survive.
The risk that we die is given by the probability that the pair consists of two male frogs, so the chance that we live is the complement of that. Using unconditional probability the risk of finding two male frogs in the pair would simply be 25%, giving a survival rate of 75%. Using conditional probability the survival rate is determined by the complement to the probability that both frogs are male given that we have heard one croak.


We use Bayes’ theorem again to calculate the probability that both frogs are male given that one of them croaked.

The unconditional probability that any two random frogs will both be male is 25%.




The probability of hearing exactly one croak from two male frogs is given by the probability of hearing two croaks subtracted from the probability of hearing either one or two croaks from the two male frogs.


The probability of hearing two croaks from two males is given by unconditional probability and is equal to the probability that one of them croaks multiplied by the probability that the other one croaks.





The probability of hearing either one or two croaks from two males is the complement to the probability that neither of them croaks.




The probability that neither one of two males croaks is given by the probability that the first frog stays silent multiplied by the probability that the second frog stays silent.




The probability of one male not croaking is equal to the complement to the probability that it croaks.







Subtracting the probability of two croaks from the probability of one or two croaks gives us the probability of exactly one croak from two male frogs.




Plugging the values we have listed so far into our formula we get the following.

The probability of hearing one croak from a pair of two random frogs is given by two probabilities added together. The first probability is given by the chance of hearing one croak from a mixed pair (male/female or female/male) multiplied by the chance that any pair of random frogs will be a mixed pair. The second probability is given by the chance of hearing one croak from an all-male pair multiplied by the chance that any pair of random frogs will be all-male.


The probability that any pair of random frogs is a mixed pair is given by unconditional probability and comes to 50% and the probability that such a pair contains two males is 25%, as can be seen from the following sample space, where half of all pairs are mixed: female/female, female/male, male/female, male/male.





We note that the probability of hearing a croak from a mixed pair must be exactly the same as the probability of hearing a croak from a single male, as a mixed pair contains exactly one male.




We recall that we have shown the probability of hearing one croak from two males to be the following. 




Plugging all of this into the formula for the probability of hearing exactly one croak from a pair of random frogs, we get this.




Reworked, it looks like this.




Bringing this into the formula for P[two males|one croak], we get the following.






We recall that the survival rate for the frog pair would be given by the complement to this probability.





Thus we end up with the following function for the survival rate when picking the pair of frogs.


This rather unwieldy expression can be simplified. As we do, we hope to prove the proposition that the function will end up being the same as the function for determining the survival rate of the single frog option.

We begin by substituting two new symbols Q and R for two of the terms found in the expression.






This gives us the following, simplified expression.

We introduce a common denominator by substituting the expression R + Q ÷ R + Q (which yields one) for the number one in the expression.

Then we exploit the common denominator to merge the two divisions into one.

The addition and subtraction of Q in the dividend cancel out, leaving us with the following.

We substitute back the expressions represented by the symbols Q and R.

We go on to use algebraic expansion.


We eliminate the inner parenthesis.


The addition and subtraction of 1 in the divisor cancel out, and the two subtractions of the term f2 add up, giving us the following.

We eliminate the remaining parenthesis.


We notice that the every term is multiplied by ½ so we can simplify the expression by multiplying each term by 2. This gives us the following.

The two additions of f add up, giving us 2f.

Finally, we divide each term by f, giving us the following.

We have arrived at the same expression as for the single frog and have thus proved that the survival rate of the single frog option and the frog pair option are exactly the same.



Discussion
This puzzle has generated a lot of online debate, no doubt in part because it is one of those tickling problems where there’s an easy, intuitive and basically correct answer (50% survival chance with both single frog and pair) that is based on unconditional probability, but there’s also a more general and therefor more correct answer based on conditional probability.
Unfortunately some of the debate is probably stirred by the fact that the popular Ted-Ed video presenting the puzzle gives the wrong answer, claiming that the pair gives a 67% survival chance but the single frog only gives a 50% chance of survival. Adding to the confusion, Popular Mechanics writes an article where they reference and endorse the Ted-Ed answer, and also introduce their own, even more misleading twist.

The Intuitive Answer

Beginning with the intuitive answer, it starts off by observing that the two options must be the same since in both cases there’s only one frog in play. Then it assumes that the chance that a single frog is female is 50%. The observation that the options are equivalent is correct and the estimation of a 50% chance of survival using unconditional probability is also roughly correct under the assumption that croaking is rare, which is a very reasonable assumption.
Intuitively we may feel that we only had a short time to listen to the frogs and if frogs were very likely to croak in such a short time they would quickly go hoarse. In a way this would give a more qualified estimate for f than the 50% implicitly assigned by the Ted-Ed video. When creating probability models, one approach is to start by assigning a 50% probability to an event but then use whatever reason you might have to nudge this initial assessment in the direction of more or less likely. It would be reasonable to argue that frogs probably don’t croak all that often, making the intuitive estimate potentially more correct than the Ted-Ed estimate.
The only issue with the intuitive argument is that it doesn’t account for survival rates given higher croaking frequencies, it would need to go from unconditional to conditional probability for that.

The Ted-Ed Answer

There are three errors in the answer given by the Ted-Ed video, listed in descending order of severity.
1)      They make the claim that it matters which option you pick. This is wrong and impossible.
2)      They don’t use conditional probability to calculate survival rate for the single frog option.
3)      They don’t mention that their calculation for the survival rate of the frog pair option relies on assuming a male frog croaking frequency of 50%. Strictly speaking this is not a math error, only a pedagogical mishap, since 50% would be the conservative choice for an unknown probability, but it would have been better to make this assumption and the relevance of the variable clear to the audience.
If you wanted to sum up the correct explanation in a way that would perhaps fit the format for a Ted-Ed video, you could say:
It doesn’t matter which choice you make, because you only have one frog to hope for either way. So let’s focus on the single frog (remember, both options are effectively single frog options).
You might think your survival chance is 50%, since that’s the chance of a random frog being female, and you would be right in that this would be your worst case survival chance. But this is not just any frog – it’s a silent frog, and the chances of a silent frog being female is greater than the chances of a random frog being female.
How much greater? That depends on how often the male frog croaks. If male frogs croak very rarely, the fact that our frog is silent doesn’t tell us very much and our survival chances approach the worst case scenario of 50%. But if male frogs croak very often, suddenly the silence of our frog speaks volumes and the chances that it must be female since it doesn’t croak all the time climb up toward 100%.
For a 50/50 chance that a male frog would croak, the chance that a silent frog is female becomes 67%, as can be seen with this simple example using frogs in boxes. The formula that gives survival rate as a function of croaking chance can be derived using Bayes theorem and ends up yielding this nice graph.

The Popular Mechanics Twist

In their article on the subject, Popular Mechanics adds a twist to the answer given by the Ted-Ed video, by stating that if you were to see the frog croaking rather than hear it, your survival chance would suddenly plummet from 67% down to 50%. It is better for your survival to hear the croaking frog than to see it!
The claim is that if you close your eyes so you can only hear the frog croak but can’t make the deadly mistake of seeing it, your chances of survival go up. But can we really believe that if we repeated the whole frog experiment 100 times with 50 sighted and 50 blindfolded candidates, then among those who picked the pair option the blindfolded subset would survive 67% of the time but only 50% of the sighted pair pickers would survive (assuming we set the experiment up so they would always see the croaking frog)? That would imply that female frogs were somehow more often present in the pair whenever a blindfolded picker showed up.
This seems a bit nonsensical, and it is. The mistake stems from the bad assumption that the survival rate with a single, silent female is 50%. 
The argument presented by Popular Mechanics goes that when you hear a croak, the sample space goes from [female/female, female/male, male/female, male/male] to [female/male, male/female, male/male], with two out of three scenarios containing a female so your survival chance becomes 67% (the same argument made by the Ted-Ed video, which is correct given a 50% croak chance). However, if you see which frog is croaking your sample space goes to either [female/male, male/male] or [male/female, male/male], with only one of the two scenarios in each case containing a female, essentially turning it into a single frog option and giving a 50% survival chance.

The issue with this argument is that, given the silence from the other frog, the two scenarios (male/female, male/male - assuming you saw the left frog croak) are not equally likely. If male croaking frequency is high, the male/female scenario is much more likely than the male/male scenario.

Like the Ted-Ed video, Popular Mechanics fails to account for conditional probability when calculating the survival chance with a single, silent frog. If they had done so, they would have noticed that the survival rate for that option was also 67%, so if you first hear the frog croak and then see a video tape of it croaking, your survival chance doesn’t plummet from 67% to 50%, it stays unchanged at 67%.

Popular Mechanics is correct in that when you see the croaking frog, the frog pair option effectively turns into the single frog option. However, they fail to recognize that the same thing happens when you hear the croak. Hearing the croak equally effectively collapses the frog pair option into a single frog option. Hearing or seeing the event doesn’t matter, it gives us the same information, which is that one of the frogs is known to be male and thus we only have one frog left in the race, and now we just have to hope that the silence of that one frog counts for something.

Conclusion

Intuition guides us well in this problem, setting the fundamental constraints correctly in observing that the two options must be equivalent and providing a lower bound on the survival rate using unconditional probability.
Adding the element of conditional probability is easy once you accept that you only have to focus on the single frog scenario. Using Bayes theorem will quickly yield the correct function for calculating survival rate given the male frog croaking frequency. The thought experiment with frogs in boxes is an easy way to build an intuition for how the terms in the conditional probability formula work together.
This presentation took the more painstaking route of using Bayes theorem to model the frog pair scenario as well in order to prove that both alternatives are indeed identical.
By showing that the survival rate function in either case is the same we have conclusively proven that both options, single frog or frog pair, are completely equivalent, depending on the male frog croaking frequency in exactly the same manner. We have also shown that it doesn’t matter if you see or hear the frog who croaks, and that intuition and common sense can be useful checks on too fantastical results by fancy mathematics.

© Mats Helander, 2020

On the Licking of Frogs

Abstract A popular math puzzle, presented in a viral video  by Ted-Ed contributor Derek Abbott , involves a poisoned hero with a chance...