They do not happen more frequently in a random bit stream. You are absolutely and completely wrong about this.
They only happen more frequently if you switch the problem from counting occurances to counting bitstreams that contain these occurrences.
The reason this is is because the sequence 111 contains two substrings of 11. Thus if this happens in a bitstream and you are counting bitstreams you only get a count of 1. Where as with the counting frequency you would still get two.
This will occur any time a sequence can be overlapped with itself.
Why care about strings containing a particular substring versus total number of occurrences? The article referenced this PDF: https://www.cs.cornell.edu/~ginsparg/physics/INFO295/mh.pdf, which is about how many coin flips it takes to see a run of N heads. That's really what the argument in the second half of my post is about, but it applies to the "how many strings contain this substring" problem too, and that one seemed simpler to draw a table for.
How likely are the substrings "11" and "10" to appear in binary strings of length 3?
rather than:
Is the sequence of '111' as equally likely to appear as '010' given that 1s and 0s are equally likely to appear?
If I throw two dice, what's the probability I throw at least one six?
Out of 36 possible throws of a pair of dice, 10 of them have a single six and 1 more has both sixes.
edit: clarification of problem.
HH, HT, TH, TT
However, if you count the sequences with at least one H there are (4-1) = 3 with at least 1 H (HH, HT, HT) as the HH eats up 2 H's.
Now, Picture 3 sided dice, that's (3x3) = 9 options. You will see ((3x3) x 1/3 x 2(flips)) = 6 2's.
00, 01, 02, 10, 11, 12, 20, 21, 22
However if you count there are (6 - 1) = 5 sequences with at least one 2 you get 02, 12, 20, 21, 22 as the 22 eats up an extra 2.
Now, what do you think happens with an N sided dice? What if N is 6.
PS: This seems less clear as I added more info...
[(x, sum(1 for i in range(2**20) if x in '{:020b}'.format(i)) / 2.0**20) for x in map('{:03b}'.format, range(8))]
The output shows a 79% chance for "000" and a 91% chance for "010". "000" and "111" are actually the least likely substrings, with "010" and "101" in second place.Furthermore, "001" has a 97% chance of occurring. It's pretty easy to see why "001" is so much more likely than the others. Unless your string perfectly alternates 0s and 1s, you're going to get repeating pairs. What happens after you get a "00"? If there's ever a 1 again, there were at least two 0s before it.
So you're almost guaranteed a "001" after "00", unless it's near the very end of the string. You only have a 50% chance of getting "000" from these though. A 1 completely resets the search for "000", but a 0 keeps the search alive for "001".
It tests if 'x' is 'in', rather than the number of times it is seen.
Since we’re dealing with a sequence that’s zettabytes long, I’d guess it falls under the category of technically true but irrelevant.
Your neighbours has two children, one of which is a girl.
What is the probability of the other child to be a girl?
A. One may say 1/2, but actually, using basic Bayes theorem: P(2 girls | at least 1 girl) = P(2 girls AND 1 at least girl) / P(at least 1 girl) = (1/4) / (3/4) = 1/3.I think this problem is actually equivalent to the Monty Hall problem. But it can get much weirder.
Your neighbour has 2 children, one is a girl.
You know the other child is born on a Sunday,
what is the probability that this other child is a girl?
A. Similarly, counting all possible cases, one does not get 1/2 or 1/3, but rather 13/27. Your neighbours has two children, one of which is a girl.
What is the probability of the other child to be a girl?
This is oft-mentioned but with this wording it's ambiguous. Here are three possible interpretations:1. Your neighbor has two children. We observed both and found that there was exactly one girl. What is the probability that both are girls? (Answer: 0)
2. Your neighbor has two children. We observed one and found that she was a girl. What is the probability that the other (unobserved) child is a girl? (Answer: 1/2)
3. Your neighbor has two children. We observed both and found that there was at least one girl. What is the probability that both are girls? (Answer: 1/3)
Interpretation #1 is kind of silly but it serves to illustrate the ambiguity of the plain English wording. Interpretation #2 is how most people interpret the problem, and it's bolstered by the use of the word "other" in your prompt. For there to be an "other" child, there must have been a specific girl observed originally, rather than a general observation that there was at least one girl. Interpretation #3 is how you intended the problem.
Edit: however now that I look into it, I should rather have used "conditional probabilities" name rather than Bayes'. I always mix both of them, my bad.
NOTE I've since edited the Wiki page, and deleted the sentence - since it isn't relevant and there was no citation for the claim!
The way you have phrased the question, the probability is 1/2.
So I guess what makes this counterintuitive is that we think of the example as independent variables actually affecting each other, but what happens is really that we're drawing from a collection without replacement, and obviously the mix of the collection is going to change as we do so.
This should apply also on a humankind, world-wide scale: if you have met three women in a row, the fourth person you meet is more likely to be a man. Gambler's fallacy! Or just drawing without replacement. A roulette table is drawing with replacement. :)
If you flip two coins, you get HH, HT, TH, and TT with equal probability. Try it.
HT is equal to TH, because in this situation we only care whether the two coins are equal to each other or different from each other.
> Why do people find probability unintuitive and difficult? Because it is unintuitive and difficult.
- If you make a distribution of the first digit of prices in a webshop you will notice that 1 appears more frequently than other digits.
- If you convert the prices to another currency and redo the distribution, the most frequent first digit will still be 1!
So it's not a given that you can assume the properties of a random bit stream will hold for the calculation in the article.
(As an aside: this weird property explains why you need slightly fewer coins in a currency that has quarters than those with 20 cent coins)
If the bit strings of length 3 are chosen uniformly, 11 is less likely to appear than 10.
(scroll about 1/3rd way down to the "(U) The OpenSesame Attack" section for the bits relevant to this discussion...)
You don't need to enumerate every n-bit sequence, you just need to enumerate a (shorter - by 62% in Samy's 12 bit case) sequence that contains all the n-bit sequences.
Interestingly enough, this isn't true!
First, let's test on a small example: how likely are the substrings "11" and "10" to appear in binary strings of length 3? Here's a table with the matches marked.
"10" can appear in four ways, but "11" can only appear in three. Why is this?Say you're scanning through a bit string, looking for "11111". You've seen "111" so far -- that's three matches. Now you encounter a "0". Your counter resets to zero matches until you see a "1" again.
Now say you're looking for "00110". You've seen "001" so far. Just like before, you encounter a "0". You still need to reset your counter, but this time the "0" may actually be the start of a new "00110". So your counter resets to one, not zero. This means "00110" matches are easier to find, and happen more frequently!