• Create Account

Banner advertising on our site currently available from just \$5!

# Digits of Pi

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

37 replies to this topic

### #21Geoffrey  Members   -  Reputation: 590

Like
1Likes
Like

Posted 25 November 2013 - 12:46 PM

Will anyone give my problem a try? You can write a simulation, if you can't think of the math...

Fairly sure it's 1/7.

The Trouble With Robots - www.digitalchestnut.com/trouble

### #22Álvaro  Crossbones+   -  Reputation: 16256

Like
0Likes
Like

Posted 25 November 2013 - 01:00 PM

Will anyone give my problem a try? You can write a simulation, if you can't think of the math...

Fairly sure it's 1/7.

Yay! This is my favorite way of introducing Bayes' theorem. I tried asking a few non-science types, and I got "1/2" a lot. I bet it's quite correlated with the Monty Hall problem.

### #23samoth  Crossbones+   -  Reputation: 6185

Like
-2Likes
Like

Posted 25 November 2013 - 01:12 PM

That's another good example of mathematics being unreal. The chance of killing yourself in Russian Roulette is known to be considerably less than 1/6 with the first shot.

Why? Because the gun doesn't care that you say it's a 1/6 chance, but gravity makes sure that most of the time the loaded chamber stops at the bottom.

Insofar, the person getting the 3rd shot in row has by far the highest chance of blowing their brain out, if there's a bullet in the gun.

But assuming the gun obeys your math, the chance is exactly 50%. Every time someone pulled the trigger, there was a chance he'd blow out his brain, assuming there was a bullet loaded in one of the chambers. And yes, pulling the trigger three times in a row and still being alive is less likely than only having to pull it once. But whatever, it didn't happen, it's over.

Now there is only one chamber left that hasn't been triggered/tried, and you must use this one. Which means you could just as well use a single-chamber gun (one of those things they use in pirate movies) that has been secretly loaded (or not loaded) by a referee (with a fair coin, if you will).

So, the chance of blowing out your brain is only dependent on whether the referee put in a bullet or not. No matter what nice mathematics you do, it only depends on whether the referee put in a bullet, or not.

### #24Álvaro  Crossbones+   -  Reputation: 16256

Like
1Likes
Like

Posted 25 November 2013 - 01:45 PM

I bet it's quite correlated with the Monty Hall problem.

Thank you, samoth, for proving my point.

### #25Álvaro  Crossbones+   -  Reputation: 16256

Like
1Likes
Like

Posted 25 November 2013 - 02:00 PM

Oh, let's convince the Erdős-style thinkers out there:

#include <iostream>
#include <cstdlib>
#include <ctime>

int main() {
std::srand(std::time(0));

int brains_blown_out_counter = 0;
int brains_not_blown_out_counter = 0;
int things_did_not_go_as_described_in_the_problem_counter = 0;

for (int i=0; i<10000000; ++i) {
bool is_there_a_bullet_at_all = std::rand() % 2;
int chamber_if_there_is_a_bullet = std::rand() % 6;
if (is_there_a_bullet_at_all == false) {
brains_not_blown_out_counter++;
}
else if (chamber_if_there_is_a_bullet == 5) {
brains_blown_out_counter++;
}
else
things_did_not_go_as_described_in_the_problem_counter++;
}
std::cout << "Brains blown out: " << brains_blown_out_counter << '\n';
std::cout << "Brains not blown out: " << brains_not_blown_out_counter << '\n';
std::cout << "Things did not go as described in the problem: " << things_did_not_go_as_described_in_the_problem_counter << '\n';
std::cout << "Frequency of brains blown out given that things did go as described in the problem: " <<
double(brains_blown_out_counter) / (brains_blown_out_counter + brains_not_blown_out_counter) << '\n';
}

Output:

Brains blown out: 834503
Brains not blown out: 4998343
Things did not go as described in the problem: 4167154
Frequency of brains blown out given that things did go as described in the problem: 0.14307

### #26samoth  Crossbones+   -  Reputation: 6185

Like
0Likes
Like

Posted 25 November 2013 - 03:16 PM

So what have you proven by counting something completely different?

This code tests whether there is a bullet at all. Fair enough. No bullet, no shot, sure thing.

Then it tests whether the bullet is in the chamber 5 (index zero based). Fine. Except if it's not, then someone blew out his brain already. The premise was that you arrive at the sixth chamber without someone having blown out his brain. So you are "proving" me wrong by proving a completely different premise.

Having arrived at chamber no. 6 (or rather no. 5, with a zero-based index like in the code) without someone blowing out his brain means exactly one thing, no more and no less, and no matter what mathematics you apply:

If there is a bullet (which is 50% likely) then it is necessarily in this chamber (100% chance). There is no other way, since all other chambers have been tested (i.e. we have proof that the bullet isn't there). You do not have a 7th chamber where you could have put the bullet. It's irrelevant from which side you try to look at it, or what mathematical trick you try. There simply is no other chamber left.

Of course, that is only true if you don't account for Heisenberg bullets which change the chamber they're in as soon as you look at them...

Edited by samoth, 25 November 2013 - 03:17 PM.

### #27Brother Bob  Moderators   -  Reputation: 9464

Like
1Likes
Like

Posted 25 November 2013 - 03:25 PM

The problem asked what the probability is that the sixth chamber contains a bullet given that the first five didn't. That is exactly what Álvaro's code counts: if there is a bullet in one of the first five chambers, then there's nothing to count because the problem didn't ask about that situation.

Edited by Brother Bob, 25 November 2013 - 03:26 PM.

### #28Paradigm Shifter  Crossbones+   -  Reputation: 5639

Like
0Likes
Like

Posted 25 November 2013 - 03:41 PM

What is the probability that if we shave all the heads of all women in the world and count the number of hairs removed for each person, 2 or more had exactly the same number of hairs? I say women since there are negligible numbers of completely bald women, and we aren't going to count 0 as a valid number of hairs. Until after our little experiment of course ;)

Edited by Paradigm Shifter, 25 November 2013 - 03:42 PM.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

### #29Geoffrey  Members   -  Reputation: 590

Like
1Likes
Like

Posted 26 November 2013 - 04:30 AM

Output:

Brains blown out: 834503
Brains not blown out: 4998343
Things did not go as described in the problem: 4167154
Frequency of brains blown out given that things did go as described in the problem: 0.14307

Nice demo.  My method was to substitute the problem for an equivalent one that's easier to reason about:

Suppose there are two guns with six barrels each, and a bullet is put into a randomly chosen barrel of one of the guns.  You then play Russian Roulette with just one of these guns, again at random.

This is equivalent to the original problem because there is still a 50:50 chance that you're playing with a loaded gun and the location of the bullet if present is still random and fair.  However the intuition is now that there are 12 equally likely places that the bullet can be (2 guns x 6 barrels).  Having ruled out five of them (the barrels already discharged) we have seven remaining locations where the bullet could be, no information about which of these is more likely, hence a 1 in 7 chance of blowing our brains out.

That's another good example of mathematics being unreal. The chance of killing yourself in Russian Roulette is known to be considerably less than 1/6 with the first shot.

Why? Because the gun doesn't care that you say it's a 1/6 chance, but gravity makes sure that most of the time the loaded chamber stops at the bottom.

Insofar, the person getting the 3rd shot in row has by far the highest chance of blowing their brain out, if there's a bullet in the gun.

That's interesting, though in this case I think such a practical consideration would further improve your chances on the 6th shot (better than 1 in 7) as it's near the top again.  Another practical consideration is that one could possibly detect the presence or otherwise of the bullet by it's weight.

The Trouble With Robots - www.digitalchestnut.com/trouble

### #30samoth  Crossbones+   -  Reputation: 6185

Like
0Likes
Like

Posted 26 November 2013 - 05:17 AM

The problem asked what the probability is that the sixth chamber contains a bullet given that the first five didn't. That is exactly what Álvaro's code counts: if there is a bullet in one of the first five chambers, then there's nothing to count because the problem didn't ask about that situation.

No. And here is the no-science type's explanation why:

The code first checks whether there is a bullet in the gun at all (50% chance). If there isn't one, you cannot blow out your brain. Quite so.

But now, in the "there is a bullet" branch comes the fallacy, the wrong assumption. The code now determines which chamber the bullet is in. There are 6 chambers, and the bullet could be in any of them, right? Wrong.

We have already pulled the trigger 5 times, and nothing has happened. There are only six chambers, it is known that there is a bullet, and it has been proven that the first 5 chambers are empty. The bullet can therefore only be in one place, there is no way it could be anywhere else.

The likelihood is 1/1, not 1/6. Proof by intimidation (Bayes theorem) does not change the fact that the bullet can only be in one location, even if the other guy is a no-science type like me.

Assuming the bullet could be in any different location simply defies reality.

Together with the 50% chance of a bullet being there at all, the 100% chance of having it in your chamber if there is one gives you a 50% overall chance. No need for complicated proofs or experiments.

Which is what I was saying: Everything with a grain of salt. Mathematics are nice, but they are not necessarily real (or applicable) because they often base on wrong assumptions or ignore important details of reality. As such, they are awesome for mathematical problems where the assumptions hold (see birthday paradox as an example) but they are not necessarily awesome for real stuff.

### #31Paradigm Shifter  Crossbones+   -  Reputation: 5639

Like
0Likes
Like

Posted 26 November 2013 - 05:36 AM

Do you believe Bayes' Theorem is correct? It's not controversial in probability, and is easy to prove. The gun not firing in the first 5 shots is evidence against there being a bullet having been loaded in the gun, that accounts for something?

If the gun has 1,000,000 barrels and you fire it 999,999 times and there is no bullet what is the chance the next shot has a bullet? The same? What happens as you take the limit to infinity?

My number of hairs question was that the probability is 1 by the way, even if we assume max number of hairs on head is 10 million (average under 200 thousand), since there are more women than that if we give them a piece of paper with their number written on it and ask them to file them we find at least 1 file with more than one woman, this is the pigeon hole principle.

Edited by Paradigm Shifter, 26 November 2013 - 05:37 AM.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

### #32Bacterius  Crossbones+   -  Reputation: 11525

Like
2Likes
Like

Posted 26 November 2013 - 06:01 AM

Together with the 50% chance of a bullet being there at all, the 100% chance of having it in your chamber if there is one gives you a 50% overall chance. No need for complicated proofs or experiments.

No, that is a fallacy, and one the paradox is designed to point out. Think about it, if the gun is empty then there is a much higher likelihood that both of you will survive the first five chambers (read: if you played many such games, where you and your opponent lived to the last chamber, then you will see the gun is empty more often than it is loaded - that is kind of the definition of probability). And so conversely, if you survived the first five chambers, then there is a higher probability the gun is empty than it is loaded. That probability turns out to be 6/7 by the proofs given above (so you die 1 out of 7 times) but that argument is enough to "intuitively" show it can't be 50%.

If you want, you can try out the problem "in real life" (with appropriate safety measures taken, please) and you will see that if you follow the problem statement carefully, the answer will come out at 1/7, not 1/2 like you say. It's not the mathematics that are wrong, it's your understanding of what the problem is saying and when it applies which is. That's why it's called a paradox, it's supposed to pick your brains. Don't take it personally, you're not the first (and won't be the last) to get all confused over things like this.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

### #33Álvaro  Crossbones+   -  Reputation: 16256

Like
0Likes
Like

Posted 26 November 2013 - 06:35 AM

Every time the trigger is pulled and the bullet is not there the hypothesis that there is no bullet should gain some weight. Bayes's theorem is not an attempt at intimidation: It's just the formula that allows you to quantify this effect. And really, this is a great opportunity to learn about it, because if you can solve this problem by an argument like Geoffrey's, you probably don't need to even remember Bayes's formula: You can deduce it when you need it.

A friend of mine proposed a variation that might help some people think about this problem. Imagine we modify the game so that after pulling the trigger we spin the barrel, then pass gun to the other player. So instead of sampling the chambers sequentially, we pick a random chamber every time. The first time someone pulls the trigger, the probability of it going off is 1/12. Let's say it does not go off. Is it 1/12 for the next attempt? We actually do this 1,000,000 times and we haven't found a bullet yet. Do you still think the probability of it firing is 1/12 at the 1,000,001st attempt? Shouldn't you start suspecting at some point that it is more likely that there is no bullet, or otherwise you probably would have found it by now?

### #34samoth  Crossbones+   -  Reputation: 6185

Like
-3Likes
Like

Posted 26 November 2013 - 06:52 AM

Do you believe Bayes' Theorem is correct? It's not controversial in probability, and is easy to prove.

I believe Bayes' theorem correct, even without proof. Bayes' theorem describes exactly the way we perceive reality, or how people think in everyday life (and, most of the time, they're correct).

The police suspects and arrests people almost exclusively based on Bayes' theorem. Your wife is killed, most wifes are killed by their spouse. Therefore you're guilty. You are (insert ethnic group). Most thefts are done by (said ethnic group). You happen to be close to the crime scene, so you're the thief.

Funnily, more often than not, it turns out they're exactly right with this dumb approach, too. So, yeah, Bayes works.

However, applying Bayes' theorem (or any such thing as probability, for that matter) when it isn't applicable is wrong. After having shown that five chambers are empty and knowing that you've put one bullet in (and you haven't taken it out, or spun the drum again, or otherwise cheated), there is only one possible outcome in a universe where guns and bullets are physical objects.

(long explanation)

There is no fallacy to it, even though your explanation sounds perfectly reasonable. It doesn't matter whether or not you've survived the previous 5 rounds, since if you haven't survived (or the other guy hasn't) then you don't meet the experiment's conditions. It's pointless to consider whether or not that happened. Also, you cannot change past events based on observations on present (or less remote) events.

The initial assumption is that you have arrived at the last chamber, and there is a 50% chance that the referee has put in a bullet.

If there is a bullet, the bullet must be in this last chamber (there is no other way!), and the referee made his decision whether or not to put one in before anyone touched a trigger. The 50% chance that there is a bullet in one chamber doesn't change after the referee has tossed his coin, merely because nobody has died during the first five rounds. The only thing that changes during the game is the number of chambers that are left (and people dying, but that is outside the frame conditions of the experiment).

Our universe works in a way that you can best describe with memory_order_seq_cst. Things (even unrelated ones) happen in a sequentially consistent way (at least at non-relativistic speeds and with real objects and without gremlins reloading your gun). The referee's decision happenes first, the state of the gun is globally visible before any player touches the gun. The gun's "loaded" state is defined a priori and doesn't change afterwards, regardless of whether you've survived the first rounds or not.

The fallacy is in thinking that your survival of the first 5 rounds can change the past.

Edited by samoth, 26 November 2013 - 06:56 AM.

### #35Paradigm Shifter  Crossbones+   -  Reputation: 5639

Like
0Likes
Like

Posted 26 November 2013 - 06:57 AM

You don't have to shoot anyone in the head to test it. All you need to do is fire a gun 5 times without it going off. Alvaro even did a simulation. You can try it yourself with playing cards anyway.

As Alvaro and myself pointed out if you have a large number of trials it gets more obvious.

Applying Bayes' Theorem to probability isn't controversial, and the proof is easy. Applying it to statistics as a measure for belief in something is controversial, we're not talking about that though?

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

### #36WarAmp  Members   -  Reputation: 750

Like
4Likes
Like

Posted 29 November 2013 - 07:05 PM

The initial assumption is that you have arrived at the last chamber, and there is a 50% chance that the referee has put in a bullet.

If there is a bullet, the bullet must be in this last chamber (there is no other way!), and the referee made his decision whether or not to put one in before anyone touched a trigger. The 50% chance that there is a bullet in one chamber doesn't change after the referee has tossed his coin, merely because nobody has died during the first five rounds. The only thing that changes during the game is the number of chambers that are left (and people dying, but that is outside the frame conditions of the experiment).

This is where your misunderstanding lies. There is a 50% chance that the referee has put a bullet in this gun. Not in this chamber. You don't know which gun you have. You might have the empty gun.

Think of it like this: You have a total of 12 available barrels. 1 barrel has the bullet.

Initial chance: 1/12

second chance 1/11

third chance 1/10

4th chance 1/9

5th chance 1/8

6th chance: 1/7.

It doesn't matter what random subset of barrels you take the first 5 samples from. If there wasn't a bullet yet, it has to be in the next 7 barrels.

Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.

### #37Paradigm Shifter  Crossbones+   -  Reputation: 5639

Like
0Likes
Like

Posted 29 November 2013 - 07:14 PM

That's a good explanation! Probs better if the other gun is in an alternate universe/parallel dimension though ;)

Edited by Paradigm Shifter, 29 November 2013 - 07:15 PM.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

### #38Postie  Members   -  Reputation: 1273

Like
0Likes
Like

Posted 01 December 2013 - 01:50 AM

I tried really hard to understand Alvaro's example, but couldn't get my head around how it would be correct. I've never been good with probabilities, and I guess that illustrates the point he was trying to make about how people's intuition can be very wrong.

That said, WOW! WarAmp comes through with an explanation that makes perfect sense to me. You start at 1/12, and every click increases the probability a little bit for the next attempt. Nice one!

Currently working on an open world survival RPG - For info check out my Development blog:

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS