Monday, August 15, 2016

Ted-Ed frog riddle is wrong, and shockingly so

The frog riddle is a lie.
My daughter watches the Ted-Ed videos with riddles in them. They are a good way to exercise your brain, unless you don't actually pause the videos to work through the answer. It is way too easy to just watch passively and not think about the correct solution.
In the frog riddle (which I've linked the analysis, and the video), there are two frogs behind you and one of them is a male and one is a female. The female frog is identical to the male frog except she has a lifesaving antidote on her skin. If you choose to go to the unknown, silent, frog in front of you then you will have a 50% chance of surviving. If you go behind you to where two frogs sit, but one of them is known to be a croaking male, then you will have a probability that may be higher, lower, or the same of being saved.
The article chooses to pick another dimension which is not directly addressed in the original riddle: whether the males croak with more or less frequency than the females. I assume this would be on average: some males would croak more than other males and some females might croak more than other females, and even more than some males! I rule this one out because it would average out or could be figured with slightly more messy math, and anyway, it wasn't addressed in the original problem.
Can you see the error in both the original video and the incorrect explanation of the article? The probability as stated in the original problem is not 2/3, it is still 1/2 or 50% for the two frogs behind you.
Pause your screens and go figure it out. I'll wait.

No, really, I'm waiting for you to figure it out, asshole.

Okay, here is my take: The problem lies in the truth table used to calculate the probability. If there are two frogs, we assume there are four probabilities:

Male Male = dead
Male Female = alive
Female Male = alive
Female Female = alive (but not possible, because one is male).

However, the middle two options are actually only one outcome! It doesn't matter which order you pick frogs from the population and arrange them in the forest. A male/female pair is exactly the same as a female/male pair. Here is the real calculation with question marks (I'm preserving order just to show the calculations. In reality it doesn't matter. But imagine you take the first frog, lick it, then take the second frog, and lick it too. What is the outcome for each trial?)

Male / ??
?? / Male


Male ?Male? = dead
Male ?Female? = alive

?Male? Male = dead
?Female? Male = alive

The probability is exactly 50% as it should be. The video makes a reference to the whole population of frogs, however. So I investigated that to see if there was something I missed. Let's take a look at a population of three frogs. What are the possible combinations of male and female frogs (with equal probability of male and female)?

MFM (dup)
FMM (dup)
FMF (dup)
FFM (dup)

Taking the unique assortments, there are three pairs of each population. You would have pair 1,2 and pair 1,3 and pair 2,3. For each, there must be one male, and if there are any females, you live. For each population there are the following pair outcomes:

MMM = MM-dead, MM-dead, MM-dead
MMF = MM-dead, MF-alive, MF-alive
MFF = MF-alive, MF-alive, FF - impossible
FFF = No possible scenarios with the male restriction

So the results are:

MMM = 3 dead
MMF = 1 dead, 2 alive
MFF = 0 dead, 2 alive, 1 impossible
FFF = 3 impossible scenarios

So in this sample population, there are four outcomes where you died and four outcomes where you lived. That's a 50% probability.

Friday, April 8, 2016

Python List Access

If you have to use python, this is the kind of bullshit you have to put up with:

$ python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=[1,2,3,4,5]
>>> a[2:]
[3, 4, 5]
>>> a[:2]
[1, 2]
>>> a[-2:]
[4, 5]
>>> a[:-2]
[1, 2, 3]

Weekly writing output

Wordcount graph
Powered by