00:01
So in this question, we're told that we have a sequence of coin flips, and each one has a probability of being heads of p.
00:07
And let x be the length of the streak, so like this.
00:13
Now, we want to find the distribution of x.
00:16
So the probability that x is equal to some value x is going to be the probability that the...
00:25
So it's going to be a product of probabilities, basically.
00:28
So let's say that fi, fi is the outcome of the ith flip.
00:45
So if x is some number x, then f2 has to be equal to f1, f3 has to be equal to f1, and this is a product all the way up to fx has to be equal to f1.
01:06
But then f x plus 1 has to not be equal to f1 okay so what have we got here so we've got the probability that the first flip is a heads times the probability that the next x minus 1 flips are heads and that the x plus 1th flip is a tails but then we've also got the probability that the initial flip is a tails so we have to add on 1 minus p and then the probability that the the x minus one flips after that are also tails, and then the flip after that is a heads.
01:51
So this gives us the probability that x is equal to little x is p, 1 minus p, p to the x minus 1 plus 1 minus p to the x minus 1.
02:05
Now to check this, we want to check this.
02:08
So we're going to check this by saying that the sum from x equals 1 up to infinity of p x equals x should be equal to one.
02:18
In fact, it must be equal to one.
02:20
So one has to be equal to p 1 minus p times the sum of, from x equals 1 to infinity of p to the x minus 1, plus the sum from x equals 1 to infinity of 1 minus p to the x minus 1.
02:39
So this is p 1 minus p.
02:42
Now we can shift these sums so that the sum from x equals 0 to infinity of p to the the x plus the sum from x equals 0 to infinity of 1 minus p to the x.
02:55
And now we can sum these because they're a geometric series.
02:59
We get p 1 minus p times 1 over 1 minus p plus 1 over p.
03:08
So this is p 1 minus p times p plus 1 minus p so 1 divided by p 1 minus p and this is indeed equal to 1.
03:20
So this is a valid probability distribution, so we can be confident in that.
03:26
Now we want to get the expectation value of x.
03:28
That's what we're asked to calculate.
03:31
And this is going to be p1 minus p times the sum from x equals 1 to infinity of x times p to the x minus 1, plus the sum from x equals 1 to infinity of x times 1 minus p to the x minus p to the x minus 1.
03:52
Minus 1.
03:56
And we can recognize this.
03:57
So we know how to sum a geometric series.
03:59
This is the derivative of a geometric series...