# Flipping two strange coins

1. Jun 14, 2014

### StrangeCoin

These two coins are strange because the probability between their heads and tails can be adjusted from 0% to 100%. What is the probability of getting two heads or two tails, if for example one coin is set to flip heads 70% and the other to flip heads 20% of the time? Thanks.

2. Jun 14, 2014

### pwsnafu

Do you know what independence means?

3. Jun 14, 2014

### StrangeCoin

Not in terms of statistics and probability. I am only able to figure out the most simple scenarios, I don't know where to even begin with this one.

4. Jun 14, 2014

### Fredrik

Staff Emeritus
Consider a normal six-sided die. The probability to roll a 6 AND then another 6 is $\frac 1 6\cdot\frac 1 6=\frac{1}{36}$. The probability to roll a 6 OR a 5 is $\frac 1 6+\frac 1 6=\frac 1 3$. A good rule of thumb is that an "and" means that you need to multiply the probabilities, and an "or" means that you need to add them.

Two events A and B are independent if knowing that one of them occurred doesn't affect the probability that the other one occurred. Suppose that you roll two dice, and see that the first one is a 6. This knowledge doesn't change the probability that the other one is a 6.

My suggestion that you interpret "and" as "multiply the probabilities" is only good when the events are independent.

5. Jun 14, 2014

### StrangeCoin

Ok, thanks. Let me try then.

Coin 1 Heads = 70%, Tails = 30%
Coin 2 Heads = 20%, Tails = 80%
---

Chance of H&H = 0.7 * 0.2 = 0.14
Chance of T&T = 0.3 * 0.8 = 0.24

Chance of H&H or T&T = 0.14 + 0.24 = 38%

6. Jun 14, 2014

### StrangeCoin

But as the number of rolls increases, doesn't it become increasingly unlikely that you would keep rolling the same number?

Getting 6 ten times in a row is less probable than rolling it only 2-3 times, so doesn't that mean that each roll is not really independent but somehow related to its history and past time?

7. Jun 14, 2014

### pwsnafu

No. The easiest way to see this is to realize that rolling a die twice, is the same thing as rolling two different dice at the same time in two different place around the world. Those two dice can't communicate with each other.

Also 6666666666 has the same probability as 6612345123. The reason why "getting 6 ten times in a row is less probable than rolling it only 2-3 times" is true is because there are more permutations of the latter. Both 6612345123 and 1234512366 have two sixes, but there is only one way to roll 6666666666.

8. Jun 14, 2014

### Fredrik

Staff Emeritus
Looks good. Note that the probabilities of the four possible sequences (HH, HT, TH and TT) add up to 1. It's a good idea to do sanity checks like this when you do probability calculations, because it's so easy to make mistakes.

9. Jun 14, 2014

### StrangeCoin

Yes, but makes this true as well, it still holds: rolling 6 on 10th try is less likely if previous nine rolls were all 6, than if they were not.

Last edited: Jun 14, 2014
10. Jun 14, 2014

### Fredrik

Staff Emeritus
This is incorrect. The probability is 1/6, regardless of what the previous results were.

11. Jun 15, 2014

### StrangeCoin

I can't disagree with that. I just feel there is more to it. Can we test it? I could write a little dice rolling program, just not sure what exactly to test for, or test against, what to compare and how.

12. Jun 15, 2014

### micromass

Sure, you can test it. Probability may be part of math, but it has a lot of empirical tests! (maybe probability should be part of physics...)

I think the most convincing way to test it is by actually getting a dice, throwing it 120 times and then recording the score. you will see you will get about 20 times 1, about 20 times 2 and so on.

Or you can use this excellent applet: http://www.math.uah.edu/stat/applets/DiceExperiment.html

13. Jun 15, 2014

### StrangeCoin

I'm talking about distribution, sequences and streaks, rather than just overall or total statistics. What I'm saying is that if we roll a dice for an eternity we should never roll 6-side 100 times in a row. And if it happens, then it means the rolls were not actually random, because that's completely the opposite of what random is supposed to be. The only thing we know about random is that it is "not in order" (seemingly at least), it must not contradict its own definition.

In other words, for random number generator to qualify as "truly" random it should never be able to produce 100 sixes in a row. Or should it? There is definitively something not quite right with the logic of using arbitrary numbers like "100", and yet by definition there really should be some point of correlation and order, in random sequences and proportional to their length, which "random" must not cross for the sake of not becoming the opposite of what it means.

14. Jun 15, 2014

### micromass

Why shouldn't we be able to roll 100 ones in a row? If the dice is truly random, then this should happen sooner or later.

However, the probability that this happens is extremely low. If you roll a dice yourself, it might never happen. But you talked about rolling the dice "for eternity". This is a very different situation.

We can calculate with some very advanced mathematics that in order to get a sequence of $n$ consecutive ones, we need to roll the dice $\frac{6^{n+1} -6}{5}$.
So in order to roll one only one time, we need to roll the dice approximately 6 times. In order to get a sequence of two consecutive ones, we need to roll the dice approximately 42 times. As you see, this is getting high very quickly!!
In order to roll a one a 100 times in a row, we need to roll the dice approximately $783,982,348,200,085,087,316,028,320,589,669,384,644,572,452,567,545,845,851,686,359,643,396,569,772,850$

This is a staggering number. It is approximately $7\times 10^{77}$. The scientific name for such a number is $783$ quattuorvigintillion.
In comparison, the current age of the universe is $4.3\times 10^{17}$ seconds. So if we started rolling dice from the start of the universe onwards, we probably haven't seen a sequence of 100 consecutive ones yet. The probability that we have is approximately $5\times 10^{-61}$, which is for all intents and purposes so close to to 0 that we can always take it equal to 0.

But then again, you talked about tossing dice forever. Then the power of infinity comes into play. Throwing a dice $7\times 10^{77}$ times is pretty trivial in the face of infinity. So if we truly could toss forever, or at least a sufficiently high number of times, then we will get a sequence of 100 heads.

Compare it with this. Let's say you throw a dice a very high number of times (like one billion times). Do you expect to see 2 consecutive ones? Of course you do. Do you expect to see 3 consecutive ones? Sure, but less times. Do you expect to see 4 consecutive ones? Of course, but even less.
So where is the boundary where you do expect to see $n$ consecutive heads, but suddenly $n+1$ is totally impossible and indicates the dice is loaded? There shouldn't be such a boundary. All rolls of consecutive heads should be possible, but not all should be likely.

For people interested in the math of the above astronomical numbers:
https://courses.cit.cornell.edu/info2950_2012sp/mh.pdf

15. Jun 15, 2014

### Stephen Tashi

People who study science and mathematics want to know facts and facts are traditionally given in terms of absolute guarantees. However, if the topic of study is probability (or any other measure of "uncertainty") then there is a fundamental problem; how can we make guarantees about something that is uncertain? The way this is handled in probability theory is that the theorems take the form: If the probability of one thing is such-and-such then the probability of another thing is so-and-so.

If you believe a statement of the form: If the probabiility of one thing is such-and-such then this other thing is guaranteed to happen (or guranateed not to happen), you may be dealing with a self-contradictory idea. As others have pointed out, the idea that each roll of a die is an independent probabilistic event contradicts any attempt to give absolute guarantees about the results of how it actually lands.

16. Jun 15, 2014

### Fredrik

Staff Emeritus
This is wrong. Let's denote the two sides of a coin by 0 and 1. If you flip a coin 10 times, it's likely (more than 50%) that the sequence of results will contain the subsequence 111. If you flip it 100 times, it's likely that the sequence will contain the subsequence 11111. (I haven't actually calculated those probabilities, so I'm not sure if that the length of the subsequence should be 5, but you get the idea). Think of any subsequence, of any length (for example "a million 1s"). There's always a number N such that if you flip the coin N times, it's likely that your subsequence will appear.

What would be the alternative to this? That you can only get the sequences 010101... or 101010...? That wouldn't be random at all.

The experiment with 100 flips is doable, so you may want to try it.

17. Jun 15, 2014

### StrangeCoin

Yikes! And there is even a word for it. I'll rename my cat to that.

I agree. The differences kind of arise due to semantics. You are willing to call a streak of sixes "random" no matter of the streak size compared to the size of the sequence, and I'm not.

Consider if the universe started rolling sixes from the beginning of time, every second another roll and every time it's a six, and so on to this day and into the eternal future. You would say that's just as likely as any other combination of the 6 possibilities, and I'm saying it doesn't even apply, it does not compute because such sequence is not random to start with, it's the opposite. It's a sort of singularity that defines "impossible", if it ever happens the universe would instantly disappear and be replaced by something more bizarre and inexplicable.

18. Jun 15, 2014

### Fredrik

Staff Emeritus
I get the impression that you've been confusing two rather different problems. One is the problem of rolling a die multiple times. The other is the weird situation that you've been sent a die from the factory and then been told that half the dice they sent out were defective and always stop on 6. In this problem, each 6 you roll makes it more likely that you are in fact rolling the defective die. But in the other problem, the die is by assumption not defective.

19. Jun 15, 2014

### StrangeCoin

Exactly. I am indeed suggesting it's one and the same problem, kind of circular reasoning and self-referencing contradiction. When 2+2 stops being equal to 4 is the same moment random becomes "perfect order" and pigs start to fly. It's impossible by definition, it's like dividing by zero.

In essence I'm saying there is a difference between "mathematical random" and "natural random", theoretical and practical. The first one includes every and all possibilities, but the second one has limits and rules. The rules guided, or manifestation of, the same laws that make the universe aggregate into complexity rather than dissipate into white noise or separate into "black" and "white".

If we don't roll six after 6 tries, every roll after that simply must become more and more likely to yield a six, that's what we observe happens in reality. There must be some defined point where probability of getting non-random sequence occurring in a random sequence is equal to "impossible". This is the point where "random sequence" changes its name to "non-random sequence", the point where "natural" becomes "artificial".

Last edited: Jun 15, 2014
20. Jun 15, 2014

### micromass

No!! We do not observe this in reality! This is called the gambler's fallacy and is confusing to so many people trying to deal with probability. The chances of getting a six never increase. Not in the mathematical theory as in the observations!

If I say that the expected number of times we need to roll the dice to get two consecutive sixes is 42. Then I mean with that something very specific. It means that I do the following experiment: I take the dice, and I roll it until I have two consecutive sixes. Then I record the number of throws.

If I do this experiment one time, then there is nothing I can say. Probability only emerges if you do something a lot of times.

What does the 42 throws mean then? It means that if I do the experiment a lot of times (say 100 times) and if I record the number of throws each time, then the average of these numbers will be 42. This means that sometimes I will get two sixes almost immediately after say 4 rolls. And sometimes I will need 100 rolls.

Probability is something that gives meaningless statements if I only do the experiment once. Everything can happen, and I do not know what it will be. Probability will be important if I repeat the experiment enough times. This is why in testing new drugs, we administer the drugs to a rather large number of people (usually around 30). If we only were to test the drugs on 1 person, then we could deduce nothing.

Also, you seem to think there is a difference between "mathematical random" and "natural random". There is no difference. Mathematical probability works perfectly with respect to the natural random. The agreement between the mathematical results and the experiments is perfect. It is one of the most succesful theories we have. It works even better than physics theories like classical mechanics which is seen to be "wrong" on certain scales. This is why probability is likely a part of math and not of physics.

I understand the issues you have with random numbers. You have some preconceptions in your head that do not match reality. I don't blame you since the human mind really has a very bad intuition of "random". Why do you think that the computer is so much better in Rock-Paper-Scissors than you? Because a computer is much better in generating random data, a human is not. A human will pick patterns like "oh, I didn't do stone in a while, so I must do that". This kind of reasoning breaks the randomness. A computer knows that and uses it to win against you. See http://www.nytimes.com/interactive/science/rock-paper-scissors.html?_r=0

I have said that the mathematics describes the randomness in nature perfectly. But please, do not take my word for it. Test it yourself! Do a version of the experiment above: "Throw a dice until you have a six. Record the number of throws you needed to do before you got 6".
Do the experiment 50 or 100 times and record the scores. You will see that the different outcomes are widely different. This illustrates the fact that you cannot say anything meaningful about the different individual experiments. But you can say something about the whole! Indeed, take the average of the scores you got and you will see that you got very close to 6.

Then, if you're good with programming. Do the above experiment but only record the number of throws until you got 5 consecutive sixes. Then do this experiment 1000 times with the computer. Look at the different outcomes, they will look very different, but the average should lie around 9330.

21. Jun 15, 2014

### StrangeCoin

I think you are basically saying anything and everything is possible given enough time, for you there is no "impossible", but instead you have "highly unlikely". On the other hand I'm saying some things are just downright clear cut impossible, like 100% impossible, in this universe as it is.

I'm not disagreeing with you. I'm just saying that if you ever really don't get a single 6 in 100 rolls it would be very unnatural, and just as likely to cause the universe to disappear and be replaced by something else.

The problem is I can prove my claim, but you can not prove yours. I can say you will never roll a dice 100 times without getting a single six. If you attempt you will most likely, if not certainly, be wasting time proving my claim instead. The question is only how low I can go, where is it that 'highly unlikely' becomes 'truly impossible'. Maybe 30 rolls without a single six is already 100% impossible. Without practically confirming otherwise you can't really be sure. An infinite sequence where it never happens is just as probable as a sequence where it does happen, that's what you're saying, right? So you must let it be a possibility too, just like the rest.

I don't think 5 in a row is enough. To reach "impossible" I suspect we need at least 30 of a kind in a row, or 30 rolls without getting some number at all. I don't think we can really test this, without infinity we don't have enough time to afford waiting for your theory to ever be proven correct, and if we ever succeed in this unnatural act, we risk splitting the whole universe apart into just black and white.

Last edited: Jun 15, 2014
22. Jun 15, 2014

### micromass

No, that's not what I'm saying at all. Some things are impossible. For example, exceeding the speed of light is impossible. The things I say are possible but highly unlikely are very specific things, and I give a very specific description of them. For example, throwing 100 consecutive sixes in a row is highly unlikely, but not impossible.

Not at all. The probability is approximately $10^{-8}$ which is low, but not that low. If you write a program that does this and run it long enough (for a billion rolls or so), then you will find some sequence of 100 rolls that does not get a single 6. Don't believe me? Try it.

No, you can't prove your claim. You can't prove a negative. The only place where you can prove a negative is in mathematics, and mathematics disagrees with you.

It is correct that I cannot prove my claim. However, I can prove many very close-related claims and I can quantify them! And I have a mathematical theory that works. The only logical conclusion is that my claim is correct. It is a leap of faith, sure, but not a big one.

See, where your claim fails is that you have no way to determine this number. Sure, you claim that you can't do a 100 rolls with only sixes. You suspect that 30 rolls also works. But what number of rolls is the smallest that works? 30? 20? You have no way of determining that. As long as you cannot quantify your theory like this, you merely have a guess.

23. Jun 15, 2014

### micromass

Alright, I just did the experiment. I programmed a computer to generate dice-rolls (in reality, it generates only 0 and 1, but it generates 1 with a probability 5/6, and 0 with a probability 1/6 so it is the same).

Then I let the computer do dice roll after dice roll. I asked the computer to stop after he had a consecutive sequence of 100 1's (which is equivalent to a consecutive sequence of 100 non-sixes with a standard dice).

The computer ran for quite a long time, 10 or 20 minutes. Finally, it did tell me that there has been a consecutive sequence of 100 1's. The computer also told me that it took $21,580,227$ dice rolls for such a sequence to arise.

If you want to play with this yourself, here is the code:

Code (Text):

#lang racket
(require math)

(define distr (discrete-dist '(0 1) '(1 5)))

(define (random-dice-roll)
(car (sample distr 1)))

(define (Experiment n)
(define (iter counter number_throws)
(define d (random-dice-roll))
(cond [(= counter n) (fprintf (current-output-port) "~a" number_throws)]
[(= d 1) (iter (+ counter 1) (+ number_throws 1))]
[(= d 0) (iter 0 (+ number_throws 1))]))
(iter 0 0))

(Experiment 100)

24. Jun 15, 2014

### StrangeCoin

Sorcery! I shell perform the experiment myself, I must know, so here I go...

25. Jun 15, 2014

### micromass

I have modified the code such that it saves all the dice rolls to a (possibly huge) file.

Code (Text):

#lang racket
(require math)

(define distr (discrete-dist '(1 2 3 4 5 6) '(1 1 1 1 1 1)))

(define (random-dice-roll)
(car (sample distr 1)))

(define MyPort (open-output-file "test.txt" #:exists 'append))

(define (Experiment n)
(define (iter counter number_throws)
(define d (random-dice-roll))
(fprintf MyPort "~a " d)
(cond [(= counter n) (fprintf (current-output-port) "~a" number_throws)]
[(not (= d 6)) (iter (+ counter 1) (+ number_throws 1))]
[else (iter 0 (+ number_throws 1))]))
(iter 0 0))

(Experiment 100)

(close-output-port MyPort)

To find where the file is located, the code (current-directory) works.

I am running it now, I will upload the file when it's done.