understanding probability theory... Infinite monkey theorem

sao123

Lifer
May 27, 2002
12,653
205
106
The infinite monkey theorem states that:

due to the nature of infinity, a monkey hitting keys at random on a typewriter keyboard will almost surely eventually type out the collected works of William Shakespeare.
(or type every book in France's Bibliothèque nationale de France (National Library). as it was said in the original version)


I thought I had a pretty intuitive view of probability in practice (theory escapes me however) but this just seems almost impossible to me.

Need explaination.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
theres nothing too difficult here, each time a moneky hits a key at complete random there is a chance it could be the right key, say a 1/32 chance or whatever (not sure how many total letters and punctuation marks there are), so if there are a million letters, then thats jsut (1/32)^1,000,000 chacne you get that. Obvisouly thats an insanely small number, but multiply it by infinity and its a certainty. Its just another stupid mind game seeing as there arent an infinite number of monkeys, but it does prove the point that even an incredably unlikely event will happen if there are an even larger number of chances. Like a trillion bacteria over 1000 generations evolving a resistance to a drug, the chance of a complely random mutation creating a drug reistance is really small, but when you have 10^12 chances to get it right you just might.
 

A5

Diamond Member
Jun 9, 2000
4,902
5
81
Well, if you have a monkey on a keyboard for an infinite amount of time, eventually it will hit the keys in a sequence that recreates (insert famous work here). In the timeframe of infinity, any event that even has the slightest probability of happening will - if it never happened, then there would be no way to attach a probability to it.
 

CSMR

Golden Member
Apr 24, 2004
1,376
2
81
Originally posted by: sao123
The infinite monkey theorem states that:

due to the nature of infinity, a monkey hitting keys at random on a typewriter keyboard will almost surely eventually type out the collected works of William Shakespeare.
(or type every book in France's Bibliothèque nationale de France (National Library). as it was said in the original version)


I thought I had a pretty intuitive view of probability in practice (theory escapes me however) but this just seems almost impossible to me.

Need explaination.
Do you understand that a monkey hitting keys at random and independently will hit the key A eventually with probability 1?
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,601
167
111
www.slatebrookfarm.com
Simply tell your professor that you disagree...

When he asks why, show, via a quick calculation, that even though you'll allow for an infinite amount of monkeys, and an infinite amount of time, the professor said nothing about an infinite amount of ink for the printers. The probability is so low that if every keystroke represented 1 particle in the universe, you'd run out of particles long before it happened. :p :) Not to mention that the keyboard will wear out!

Seriously, though, I see your point, and I agree with you to a certain degree. I'd love nothing more than to see some sort of Eureka proof which somehow proves that statement incorrect. (But, I still acknowledge that the statement is true... at this point.)


 

Gibsons

Lifer
Aug 14, 2001
12,530
35
91
I think one issue is that it's difficult to conceive of a monkey using the keyboard in a way that's truly random. The scenario implies or assumes that it is random, though.
 

sao123

Lifer
May 27, 2002
12,653
205
106
Originally posted by: DrPizza
Simply tell your professor that you disagree...

When he asks why, show, via a quick calculation, that even though you'll allow for an infinite amount of monkeys, and an infinite amount of time, the professor said nothing about an infinite amount of ink for the printers. The probability is so low that if every keystroke represented 1 particle in the universe, you'd run out of particles long before it happened. :p :) Not to mention that the keyboard will wear out!

Seriously, though, I see your point, and I agree with you to a certain degree. I'd love nothing more than to see some sort of Eureka proof which somehow proves that statement incorrect. (But, I still acknowledge that the statement is true... at this point.)


If I only had a professor to ask... sadly I did not think of this six years ago.
Actually I found this, because it was one of todays featured articles on wikipedia.

now back to my thoughts...

Assuming a 104 key standard keyboard...
the chance of not typing the word banana in a block of 6 letters is 1 - 1 / 104^6.
the chance of not typing the word banana in the first Z blocks of 6 letters is
(1 - 1 / 104 ^ 6) ^ Z Az Z grows... the probability of not typing the string get smaller, thus eventually guaranteeing the string will be typed...

so far so good.

but for strings approaching very large values, would cause the second term to shrink exponentially, thus leading to an infinity vs infinity concept.
(1 - 1 / 104 ^ ? ) ^ ? which this should either lead to an indeterminate value or 0. Either way, the theory should not hold in this case.

(forgive me I lost the alt code for infinity)
 

CSMR

Golden Member
Apr 24, 2004
1,376
2
81
You have an upper bound with your formula, which is what you need. The probability of a monkey typing a particular countably infinite sequence eventually is zero. William Shakespeare's works are of finite length, not infinite.
 

kevinthenerd

Platinum Member
Jun 27, 2002
2,908
0
76
Originally posted by: sao123
The infinite monkey theorem states that:

due to the nature of infinity, a monkey hitting keys at random on a typewriter keyboard will almost surely eventually type out the collected works of William Shakespeare.
(or type every book in France's Bibliothèque nationale de France (National Library). as it was said in the original version)


I thought I had a pretty intuitive view of probability in practice (theory escapes me however) but this just seems lmost impossible to me.

Need explaination.

almost impossible != impossible

almost impossible = improbable but possible, and certain to occur at least once with an infinite number of trials

Flip a coin millions of times. Even a coin that is quite unfair is still going to give you at least one heads. Roll a dice millions of times. You're going to get a streak of three one's in a row at least once. Sure, writing the complete works of Shakespeare is very unlikely, but given the conditions of the problem, the infinte number of trials would dictate that it's possible.

I'm not holding my breath, though.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
really, I think people are overcomplicating these things. If you are willing to accept that there are no laws of physics violated by this occurance, and that there is some increabibly small chance that it can happen then you should understand that when you multiply that chance by infinity the occurance is a sure thing to happen. Now, of course it is just a stupid little statement that will never happen in real life, but the point is still valid.

The real application as I stated previously is that it shows how even a very unlikely occurance can and will occur if there are an equally large number of chacnes for it to occur. Just look at some famous engineering disasters, and often you will see an series of very unlikely mishaps leeding up to the eventual disastor, but when you consider all the millions of places there are for things to go wrong, its inevitable that sometimes they will. Like the cance of lightning hitting a dry area in the middle of a forest and starting a forest fire is very low, but every year there are forest fires, or people getting struck by lighting works too. I mean hell, even look at the chacnes of a single celled sperm meeting a single egg cell is incredibly unlikely, but try a few million of the suckers and it led to every single one of us being here today...

Think about Murphys law "if it is possible for something to go wrong then eventuall it will go wrong", this is where I see the biggest application of this principle. Now many people might consider this to be a pessimistic outlook on life, but it is an extremely valid observation that if ther is a finite probability of failure then eventually failure will occur. I'm only an engineering student, and already I have learned that whatever you design it has to be designed with considerable tolerances left in place, and even with that there will always be some idiot who manages to screw it up. I'm sure many of us here have had to write programs where the error checking portion was larger then the actualy program itself, certainly I have argued in the past with teachers about what type of complete idiot would type numbers into a text box asking for their name, or type the number 5 billion into one asking for their age, but you HAVE to assumme that someone will, because eventually it WILL happen.
 

Thraxen

Diamond Member
Dec 3, 2001
4,683
1
81
A monkey wouldn't hit keys randomly all the time. So it wouldn't never happen.
 

Gibsons

Lifer
Aug 14, 2001
12,530
35
91
Originally posted by: Thraxen
A monkey wouldn't hit keys randomly all the time. So it wouldn't never happen.

As stated above, the hypothetical scenario assumes that it is random and that the typewriter ribbon is infinite, the monkey never dies, never gets bored hitting keys, etc etc...
 

sao123

Lifer
May 27, 2002
12,653
205
106
does this theory then necessarily rule out all occurances of singularly occuring random phenomenon?

Lets say event X happen within the first countable infinity of chances. Using the fact that event X happened, this determines that the probability of event X must be greater than zero. By removing that countable space, I still have an uncountable remaining infinity of space left. I can reapply that theory to say that it must happen again.

This seems to null and void statements like lightning never strikes the same place twice...indeed it must strike that place an infinite many times.
Equivolly, life must exist on multiple planets... and not just life, an exact mirror of earth and humans must exist somewhere.
This seems to specifically state that all random events must happen infinitely number of times.

That seems to contradict the whole concept of random probability.
 

Thraxen

Diamond Member
Dec 3, 2001
4,683
1
81
Originally posted by: Gibsons
Originally posted by: Thraxen
A monkey wouldn't hit keys randomly all the time. So it wouldn't never happen.

As stated above, the hypothetical scenario assumes that it is random and that the typewriter ribbon is infinite, the monkey never dies, never gets bored hitting keys, etc etc...

Yeah, I know. I just remembered someone posting a study here on Anandtech a while back where monkeys were actually given a typewriter. They did hit the keys but they showed a preference for certain letters.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
comeon people, its not suppsoed to frikin represent the real world, it has nothing to do with typewritters or monkey, or anything like that. All it says is that if something has a finite probability and an infinite number of chacnes to occur then it will occur. The whole monkey on a typewritter thing is just trying to make a funny example of a mathmatical formula. I dunno, maybe some people here think its clever to point out that mokeys would jsut throw poo at the keyboard, or that hte typewritter would break, but that is just missing the entire point.
 

CSMR

Golden Member
Apr 24, 2004
1,376
2
81
Originally posted by: sao123
does this theory then necessarily rule out all occurances of singularly occuring random phenomenon?

That seems to contradict the whole concept of random probability.
It rules out a singly occuring event whose probability of occurence at each period is independent of other occurences.
 

liquid51

Senior member
Oct 14, 2005
284
0
0
yes, the monkey-keyboard analogy is an attempt to make the concept readily understandable. But what you cannot miss is the fact that there is A monkey and A keyboard. You must have something acting apon something else for this to be true. Just because life is present here does not mean that life MUST be present elsewhere, given an infinite amount of time.
I can put a bird in a cage and feed him. In due time, he will crap on the newspaper. I can also set up a bird cage with no bird, but no matter how long I wait, there will never be crap on the newspaper. This is of course ignoring the idea that given enough time a bird just might evolve in the cage, and then would mess the paper (if you subscribe to the theory of evolution). But that brings the argument full circle; from what will the bird evolve if nothing is present in the cage? Given an infinite amount of chances, will the amino acids form themselves from the vacuum?
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,601
167
111
www.slatebrookfarm.com
Originally posted by: liquid51
yes, the monkey-keyboard analogy is a attempt to make the concept readily understandable. But what you cannot miss is the fact that there is A monkey and A keyboard. You must have something acting apon something else for this to be true. Just because life is present here does not mean that life MUST be present elsewhere, given an infinite amount of time.
I can put a bird in a cage and feed him. In due time, he will crap on the newspaper. I can also set up a bird cage with no bird, but no matter how long I wait, there will never be crap on the newspaper. This is of course ignoring the idea that given enough time a bird just might evolve in the cage, and then would mess the paper (if you subscribe to the theory of evolution). But that brings the argument full circle; from what will the bird evolve if nothing is present in the cage? Given an infinite amount of chances, will the amino acids form themselves from the vacuum?

Of course, if you subscribe to the laws of quantum mechanics, there is a finite probability that the bird in your neighbors house will spontaneously disappear from the cage there and reappear in your cage (in which case it would immediately crap on the newspaper. At least, I think it would. I know that if I spontaneously did that, I'd crap my pants, assuming they were still with me.)
 

liquid51

Senior member
Oct 14, 2005
284
0
0
Originally posted by: DrPizza
Of course, if you subscribe to the laws of quantum mechanics, there is a finite probability that the bird in your neighbors house will spontaneously disappear from the cage there and reappear in your cage (in which case it would immediately crap on the newspaper. At least, I think it would. I know that if I spontaneously did that, I'd crap my pants, assuming they were still with me.)

=) How I do enjoy this forum
 

Harabec

Golden Member
Oct 15, 2005
1,369
1
81
Can't we test this, just for fun?
IIRC, Java has a random number generator. If a programmer could develop a random letter generator I'm sure someone would be willing to run it on their computer.

Perhaps a contest in Distributed Computing on who gets Macbeth first?
 

Looney

Lifer
Jun 13, 2000
21,938
5
0
Originally posted by: sao123
The infinite monkey theorem states that:

due to the nature of infinity, a monkey hitting keys at random on a typewriter keyboard will almost surely eventually type out the collected works of William Shakespeare.
(or type every book in France's Bibliothèque nationale de France (National Library). as it was said in the original version)


I thought I had a pretty intuitive view of probability in practice (theory escapes me however) but this just seems almost impossible to me.

Need explaination.

Simple. You're unable to comprehend the concept of infinity.