The frog puzzle: simple probability isn't so simple; intuition and generalization

220 Views Asked by At

There have been numerous discussions of the frog puzzle. Below is a puzzle followed by some solutions:

"You're poisoned in the jungle and the only way to save yourself is to lick a special kind of frog. To make matters worse, only the female of that species will do. Licking the male frog doesn't do anything. The male and female frogs look identical and appear with equal probabilities. The only difference is that the male frogs sometimes emit a distinctive croak.

You spot a frog in front of you, but then you hear a croaking sound behind you. You turn around and spot two frogs there. There's only time to run to one side. Which way should you run?"

(1) The original solution to the puzzle gives the probability 2/3 of survival if you run to two frogs, which is wrong. The original solution assumes that the problem is equivalent to finding a female in a reduced sample space $MM$ $MF$ $FM$ and doesn't take into account the fact that you heard a croaking.

(2) Another solution is that since you hear a croaking, you may represent a male frog as $M_c$ if it croaked and $M_n$ if it didn't croak, so the new sample space is $M_cM_n$ $M_nM_c$ $FM_c$ $M_cF$, which gives a 1/2 probability that there is a female among the two frogs.

(3) The correct solution (I believe) is that if the probability that a male frog croaks during a short time interval that you were listening for croaks is $p$, then the probability that there is a female among the two frogs is $$ \begin{align*} &P(FM\mbox{ or }MF | \mbox{one croak})\\ &=\frac{P(\mbox{one croak}|FM\mbox{ or }MF) P(FM\mbox{ or }MF)}{ P(\mbox{one croak}|FM) P(FM) + P(\mbox{one croak}|MF) P(MF) + P(\mbox{one croak}|MM)P(MM)}\\ &=\frac{p\cdot0.5}{0.25p+0.25p+0.25p(1-p) + 0.25(1-p)p}\\ &=\frac1{2-p} \end{align*} $$ Here we're using Bayes' Theorem.

If we look at the single frog that didn't croak, the probability that it is female is $$ \frac{ P(F)}{ P(M_n) + P(F)} = \frac{0.5}{0.5+0.5(1-p)} = \frac1{2-p} $$ So it doesn't matter which direction you run!

Does anyone have a good intuition as to why it doesn't matter which way you run? Does there exist an intuitive way to arrive at the answer in a general case:

" There are $n$ frogs and $m$ of them croak. What is the probability that one of the frogs is female? "

If $m=0$, we can use the Binomial Theorem to get $$ 1-\frac{(1-p)^n}{{n\choose0} + {n\choose1}(1-p) + {n\choose2}(1-p)^2+\ldots + {n\choose n}(1-p)^n} = 1-\left(\frac{1-p}{2-p}\right)^n $$ I suspect that the answer to the general case is $\displaystyle 1-\left(\frac{1-p}{2-p}\right)^{n-m}$ because we can just "ignore" the croaking frogs. I'm looking for a good intuitive explanation as to why that's true (if it is true, of course).

A further generalization would be skewing the probability of a male vs. female frog. Let's say that the probability that any given frog is male is $x$. Then the above formula for the case $m=0$ becomes $$ 1-\frac{x^n(1-p)^n}{{n\choose0}(1-x)^n + {n\choose1}(1-x)^{n-1}x(1-p) + {n\choose2}(1-x)^{n-2}x^2(1-p)^2+\ldots + {n\choose n}x^n(1+p)^n} = 1-\left(\frac{x(1-p)}{1-xp}\right)^n $$ Is there a good answer for this more general case with $n$ frogs, $m$ of which are croaking?

3

There are 3 best solutions below

2
On

Because the presence of croaking identifies a frog as male with certainty, but not all male frogs are observed to croak, this is informative of the frog's sex; thus one must posit a model in which there is a probability $p \in (0,1]$ of observing a male frog croaking, with assumptions about the independence of frogs croaking.

Let's first deal with the case of seeing a single frog that does not croak. The probability it is female is $$\Pr[F \mid \bar C] = \frac{\Pr[\bar C \mid F]\Pr[F]}{\Pr[\bar C]} = \frac{\Pr[\bar C \mid F]\Pr[F]}{\Pr[\bar C \mid F]\Pr[F] + \Pr[\bar C \mid M]\Pr[M]} = \frac{1 \cdot \frac{1}{2}}{1 \cdot \frac{1}{2} + (1-p) \cdot \frac{1}{2}} = \frac{1}{2-p},$$ as you stated. This answer makes intuitive sense: in the limiting case where male frogs are never observed to croak ($p = 0$), then the lack of croaking is non-informative of the sex, and we are equally likely to have seen a female versus a male; conversely, in the limiting case where a male is guaranteed to croak ($p = 1$), then the lack of croaking is fully informative of the frog being female.

Now let's deal with the general case with seeing $n$ frogs but hearing one croak. We are interested in the random variable $X$ that counts the number of females among the $n$ frogs.

$$\Pr[X = 0 \mid C] = \frac{\Pr[C \mid X = 0]\Pr[X = 0]}{\Pr[C]}.$$ The numerator is easy enough, but the denominator needs to be further decomposed via the law of total probability:

$$\Pr[C] = \sum_{x=0}^n \Pr[C \mid X = x]\Pr[X = x].$$ Since we assume that $X \sim \operatorname{Binomial}(n, \theta = 1/2)$, and male frogs croak independently with probability $p$ of the presence of any other male frogs (which is not true in nature, as males exhibit competitive vocalizations), then if $X = x$ frogs are female, the probability of hearing at least one of them croak is $$\Pr[C \mid X = x] = 1 - \Pr[\bar C \mid X = x] = 1 - (1-p)^{n-x},$$ and $$\Pr[C] = 2^{-n} \sum_{x=0}^n (1 - (1-p)^{n-x}) \binom{n}{x} = 1 - (1 - p/2)^n.$$ Consequently, $$\Pr[X = 0 \mid C] = \frac{(1-(1-p)^n)\binom{n}{0}2^{-n}}{1 - (1-p/2)^n} = \frac{1-(1-p)^n}{2^n - (2-p)^n}.$$ Hence the probability of having at least one female frog among the $n$ frogs, given that a croak was heard, is $$\Pr[X \ge 1 \mid C] = 1 - \Pr[X = 0 \mid C] = 1 - \frac{1-(1-p)^n}{2^n - (2-p)^n},$$ and in the case where $n = 2$, this simplifies to $2/(4-p)$. This is not the same as the single frog case and in fact is worse except when $p = 0$, in which case they are equal. Note that this result assumes you are not able to infer any information between single versus multiple croaks.

When $n > 2$, then heading for the $n$ frogs becomes increasingly prefrable except in the case where $p$ is close to $1$.


As for the generalization, suppose we are directly observing a group of $n$ frogs, and we see $m$ of them croak. As before, prior to croaking, each frog is equally likely to be male or female, and given that a frog is male, it has a probability $p$ of croaking independent of any other frogs. So now we let $C$ be a random variable that counts the number of croaking frogs. Then the probability that at least one frog is female, given $m$ croaking frogs, is $$1 - \Pr[X = 0 \mid C = m] = 1 - \frac{\Pr[C = m \mid X = 0]\Pr[X = 0]}{\Pr[C = m]}.$$ The unconditional probability of observing exactly $m$ croaking frogs is $$\Pr[C = m] = \sum_{x=0}^{n-m} \Pr[C = m \mid X = x] \Pr[X = x],$$ since if the number of females exceeds $X > n-m$, it is not possible to observe $m$ croaking frogs--females do not croak. In a subgroup of $n-x$ male frogs, the probability that exactly $m$ croak is itself binomial: $$\Pr[C = m \mid X = x] = \binom{n-x}{m} p^m (1-p)^{n-x-m}, \quad 0 \le m \le n-x, \quad 0 \le x \le n.$$ Hence $$\Pr[C = m] = \binom{n}{m} 2^{-n} (2-p)^{n-m} p^m = \binom{n}{m} (p/2)^m (1 - p/2)^{n-m}.$$ That is to say, it is the PMF of a binomial random variable with parameters $n$ and $p/2$. Then the desired probability is $$\Pr[X \ge 1 \mid C = m] = 1 - \frac{\binom{n-0}{m} p^m (1-p)^{n-m} 2^{-n} }{\binom{n}{m} (p/2)^m (1-p/2)^{n-m}} = 1 - \left(1 - \frac{1}{2-p}\right)^{m-n}.$$ This agrees with your computation. Moreover, it addresses the difference in interpretation that we encountered earlier, since in the case $n = 2$, $m = 1$, we get $\Pr[X \ge 1 \mid C = 1] = \frac{1}{2-p}$, which is the same as your answer in $(3)$.


Edit 2: To answer the non-equiprobable case $\theta \ne 1/2$, we simply modify the above computation. We get $$\Pr[C = m] = \binom{n}{m} (p(1-\theta))^m (1 - p(1-\theta))^{n-m},$$ and $$\Pr[X \ge 1 \mid C = m] = 1 - \left( 1 - \frac{\theta}{1-p(1-\theta)} \right)^{n-m},$$ where $\theta$ is the prior probability of the frog being female.

0
On

Suppose there is one frog in front of you and one frog behind you, and you hear no croak. Clearly, it does not matter which way you turn, since you have no information about either frog. Now add a male frog behind you, wait for it to croak, and now make your choice. The addition of the male frog and croak don't make a difference to the other frogs at all - although they're both now somewhat more likely to be female since you didn't hear them croak, that chance has changed by the same amount for both of them. Your choice is between a frog you know little about, and a frog you know little about plus an irrelevant male frog. Since you know equally little about the two frogs you didn't hear, it doesn't matter which you choose. Placing a male frog behind you and waiting for it to croak will not make its companion any more likely to be female than the lone frog in front of you.

Another way to view it is that the two frogs that didn't croak are indistinguishable. I could switch those two silent frogs after you make your choice, and you would have no way of knowing. It's not possible that one is more likely to be female than the other.

0
On

Ahead of you is a frog that's either a female or a non-croaking male. Behind you is one frog that's a croaking male and another frog that's either a female or a non-croaking male. Since you're going to lick both frogs if you opt for the ones behind you, you can disregard the fact that one of them is definitely a (croaking) male. That is, you can simply think of the situation as consisting of what's ahead of you is either a female or a non-croaking male while what's behind you is exactly the same thing. So it doesn't matter which choice you make.

Note, this analysis doesn't care what the ratio is of males to females. If the probability of a randomly encountered frog being a female is $F$ and the probability of it being a non-croaking male is $N$ (with $0\lt F+N\lt1$ since the problem establishes that both croaking and non-croaking frogs exist, but with no other constraints on the probabilities $F$ and $N$), the probability of living (by licking a female) is $F/(F+N)$.