9 fair coins are independently tossed in a row. Let X be the random variable denoting the number of instances in which a Head is immediately followed by a Tail during these 9 tosses. The variance of X has the form b a , where a and b are coprime integers. What is the value of a + b ?
Details and assumptions
Note: If we have 5 coins which are tossed as H T T H T , there are 2 instances in which a Head is immediately followed by a Tail; they have been underlined.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Note that X can be only integers from 0 to 4 (obviously), and that the total number of different sequences that 9 coin tosses can produce is 2 9 = 5 1 2 . Now we consider for each X from 0 to 4, how many possible sequences can arise.
For X = 0 , the sequence has to be: T T . . . T H H . . . H . The number of T's can range from 0 to 9, and the number of H's will change accordingly, hence there are 10 sequences in this case.
For X = 1 , the sequence has to be: T T . . . T H H . . . H T T . . . T H H . . . H . For simplicity we shall rewrite this as T H T H , where each T and H represent a string of Ts or Hs, respectively. Note that the 'inner' 2 strings of H and T must represent at least 1 coin toss, in order for there to be "consecutive coin tosses that yields a Head and then a Tail". On the other hand, the T-string in front and the H-string at the back can represent 0 coin tosses or more. Hence, the number of such sequences is simply the number of ways to solve a + b + c + d = 9 , where b , c ≥ 1 and a , d ≥ 0 . We may further simplify this problem to a + p + q + d = 7 , by using the substitution p = b − 1 , q = c − 1 , so that now a bijection can be made to arranging 7 'items' and 3 'dividers', to produce such a sequence of ( a , p , q , c ) , so there are ( 7 1 0 ) = 1 2 0 such sequences.
For X = 2 , we adopt a similar approach. Using a 'skeleton' of THTHTH, and knowing that the middle 4 strings need to represent at least 1 coin toss each, we have that the number of sequences is equivalent to the number of ways of putting the remaining 5 coin tosses into 6 strings, i.e. ( 5 1 0 ) = 2 5 2 .
For X = 3 , by a similar approach, there are ( 3 1 0 ) = 1 2 0 sequences
For X = 4 , by a similar approach, there are ( 1 1 0 ) = 1 0 sequences for X=4.
[A quick check, summing 10+120+252+120+10 yields 512, which is the total number of sequences.]
Now, the mean value of X, by symmetry, has to be 2. To calculate variance, we get 5 1 2 1 0 ( 0 − 2 ) 2 + 5 1 2 1 2 0 ( 1 − 2 ) 2 + 5 1 2 2 5 2 ( 2 − 2 ) 2 + 5 1 2 1 2 0 ( 3 − 2 ) 2 + 5 1 2 1 0 ( 4 − 2 ) 2 = 8 5 . Hence the answer is 13.
Let Y be the random variable of the number of HT pairs out of the 9 coin tosses. Furthermore, let X i be the random variable that the i t h coin comes up heads and the ( i + 1 ) t h coin comes up tails. That is, X i = 1 if the i t h coin is heads and the ( i + 1 ) t h coin is tails, and is 0 otherwise. All this implies,
Y = X 1 + X 2 + ⋯ + X 8
It is tempting to express the variance of Y as a linear combination of the variances of each of the X i 's. However, we cannot do this because X i and X i + 1 are not independent. In this case we must use the more general formula for the variance of a linear combination:
V a r ( ∑ i = i N X i ) = ∑ i = 1 N V a r ( X i ) + 2 ∑ E ( ( X i − μ i ) ( X j − μ j ) )
where the last sum is over all pairs of ( i , j ) such that 1 ≤ i < j ≤ N . Also, E denotes the expectation value of the quantity in the parentheses.
E ( ( X i − μ i ) ( X j − μ j ) ) is just the covariance of X i and X j , and in our case is 0, unless j = i + 1 . This is because when two random variables are independent, their covariance is 0. The HT pairs are independent unless they are adjacent to each other, in which case j = i + 1 . So we only need to sum over E ( ( X i − μ i ) ( X i + 1 − μ i + 1 ) ) from i = 1 to i = 7
The above quantities can be calculated by hand. We first have:
μ i = 1 ∗ ( 4 1 ) + 0 ∗ ( 4 3 ) = 4 1
And,
V a r ( X i ) = ( 1 − 4 1 ) 2 ∗ 4 1 + ( 0 − 4 1 ) 2 ∗ 4 3 = 1 6 3
And,
E ( ( X i − μ i ) ( X i + 1 − μ i + 1 ) ) = ( 1 − 4 1 ) ∗ ( 0 − 4 1 ) ∗ 4 1 + ( 0 − 4 1 ) ∗ ( 1 − 4 1 ) ∗ 4 1 + ( 0 − 4 1 ) ∗ ( 0 − 4 1 ) ∗ 2 1 = − 1 6 1
Putting it all together, we have:
V a r ( Y ) = V a r ( ∑ i = i 8 X i ) = ∑ i = 1 8 V a r ( X i ) + 2 ∑ E ( ( X i − μ 1 ) ( X j − μ 2 ) ) = 1 6 3 ∗ 8 + 2 ∗ ( − 1 6 1 ) ∗ 7 = 8 5 .
Our answer is 5 + 8 = 1 3 .
This solution uses the linear expansion of variance, which makes the problem more approachable than attempting to calculate the probability distribution function of the random variable X itself.
It helps that many of the cross terms are 0, and that is because these events are independent, if they have no coins in common.
We analyze the distribution of X first and then calculate its variance.
Let n ≥ 1 be an integer. Suppose that x 1 , ⋯ , x n is a possible outcome of the n tossed fair coins. Whenever x j = x j + 1 , we say that there is a flip . The number of cases when there are m flips is ( k n − 1 ) .
In the cases when x 1 = H , X = k is equivalent to exactly 2 k − 1 or 2 k flips; when x 1 = T , X = k is equivalent to 2 k or 2 k + 1 flips. Therefore
P [ X = k ] = 2 n ( 2 k − 1 n − 1 ) + ( 2 k n − 1 ) + ( 2 k n − 1 ) + ( 2 k + 1 n − 1 ) = 2 n ( 2 k n ) + ( 2 k + 1 n ) = 2 n 1 ( 2 k + 1 n + 1 )
In the calculation of the variance of X , we will need to calculate a few summations related to binomial coefficients. We summarize and prove them here:
(1) k ≥ 0 ∑ ( 2 k + 1 n ) = 2 n − 1
(2) k ≥ 0 ∑ ( 2 k + 1 n ) ( 2 k + 1 ) = n 2 n − 2
(3) k ≥ 1 ∑ ( 2 k + 1 n ) ( 2 k + 1 ) ( 2 k ) = n ( n − 1 ) 2 n − 3
To prove these, notice that if f ( x ) = ( 1 + x ) n = ∑ k ≥ 0 ( k n ) x k then g ( x ) : = 2 f ( x ) − f ( − x ) = k ≥ 0 ∑ ( 2 k + 1 n ) x 2 k + 1 .
Formula (1) can be found by evaluating g ( 1 ) . To prove (2), we calculate g ′ ( 1 ) :
k ≥ 0 ∑ ( 2 k + 1 n ) ( 2 k + 1 ) = 2 f ′ ( 1 ) + f ′ ( − 1 ) = n 2 n − 2
To prove (3), calculate g ′ ′ ( 1 ) :
k ≥ 1 ∑ ( 2 k + 1 n ) ( 2 k + 1 ) ( 2 k ) = 2 f ′ ′ ( 1 ) − f ′ ′ ( − 1 ) = n ( n − 1 ) 2 n − 3
The mean of X is: E [ X ] = 2 n 1 k ≥ 0 ∑ ( 2 k + 1 n + 1 ) k = 2 n 1 k ≥ 0 ∑ ( 2 k + 1 n + 1 ) 2 ( 2 k + 1 ) − 1 = 2 n 1 2 ( n + 1 ) 2 n − 1 − 2 n = 4 n − 1 .
The mean of X 2 is: E [ X 2 ] = 2 n 1 k ≥ 0 ∑ ( 2 k + 1 n + 1 ) k 2 = 2 n 1 k ≥ 0 ∑ ( 2 k + 1 n + 1 ) 4 ( 2 k + 1 ) ( 2 k ) − ( 2 k + 1 ) + 1 = 2 n 1 4 ( n + 1 ) n 2 n − 2 − ( n + 1 ) 2 n − 1 + 2 n = 1 6 ( n + 1 ) n − 2 ( n + 1 ) + 4 = 1 6 n 2 − n + 2
Therefore the variance of X is equal to: E [ X 2 ] − E [ X ] 2 = 1 6 n 2 − n + 2 − 1 6 n 2 − 2 n + 1 = 1 6 n + 1
When n = 9 , this is equal to 8 5 .
In order to find the variance, we must find the expected value. Since there are 8 pairs of consecutive flips when we flip 9 coins, and each one has a 1/4 chance of being successful, we have an expected value of 8 / 4 = 2 .
Now to find the distribution of possibilities, consider 9 “stars”, denoted with O’s.
O O O O O O O O O
We want to use stars and bars, so let’s create a correspondence between coins flips and our stars and bars. We will look at every sequence of flips as a chain of T’s, followed by a chain of H’s, followed by a chain of T’s, ... ended with a chain of H’s. All of these chains will have a positive number of elements, except for possibly the ends. For example, the sequence TTHHHTTTH corresponds to
O O | O O O | O O O | O
and the sequence HHHHHHTTT corresponds to
| O O O O O O | O O O |
Note that since our sequence will have an even number of chains of T’s and H’s, so it has an odd number of bars.
Now we have to count up our possibilities. Consider all sequences with 0 HT combinations. These sequences must be in the form TH, where T and H represent blocks of T’s and H’s, repectively. Keeping in mind that we can have 0 of an endpoint (e.g. just H), our stars and bars correspondence says that there are ( 1 1 0 ) sequences of this form.
Consider sequences with 1 HT combination. These sequences are in the form THTH, where endpoints can be 0. Stars and bars gives us ( 3 1 0 ) of these. Similarly, there are ( 5 1 0 ) sequences with 2 HT’s, ( 7 1 0 ) with 3, and ( 9 1 0 ) with 4. Calculating the variance from here is simple by following the formula.
variance = 5 1 2 1 ( ( 1 1 0 ) ( 0 − 2 ) 2 + ( 3 1 0 ) ( 1 − 2 ) 2 + ( 5 1 0 ) ( 2 − 2 ) 2 + ( 7 1 0 ) ( 3 − 2 ) 2 + ( 9 1 0 ) ( 4 − 2 ) 2 )
= 5 1 2 1 ( 4 0 + 1 2 0 + 0 + 1 2 0 + 4 0 ) = 5 1 2 3 2 0 = 8 5 .
Finally, we have a + b = 5 + 8 = 1 3
Throwing 9 fair coins will result in 2 9 = 5 1 2 different cases. In each case, we can have 0, 1, 2, 3 or 4 "Head-Tail" pairs (HT-pairs), since 5 HT-pairs will require at least 5 heads and 5 tails, but we have only 9 coins.
Now we count the number of cases that will lead to 0, 1, 2, 3 and 4 HT-pairs. We denote a HT pair by A, and a sequence of non-HT pairs by B (B can be a sequence with no elements). Also observe that a k-sequence of non-HT pairs consists of (k+1) possible combinations, {(TT..T), (T...TH), (T...TH), ... , (HH...H)}, since no tails can occur downstream of the sequence after one head has occurred.
The possible sequences are denoted below:-
0 HT-pair: B
B must be of sequence 9. Therefore there is a total of 1 0 combinations.
1 HT-pair: B 1 A B 2
B 1 and B 2 must add up to be of sequence 7. There are 8 ways of doing so, where ( B 1 , B 2 ) = ( 0 , 7 ) , ( 1 , 6 ) , . . . , ( 7 , 0 ) . Multiplying each cases and summing them up, we have 1 × 8 + 2 × 7 + . . . + 8 × 1 = 1 2 0 combinations.
3 HT-pairs: B 1 A B 2 A B 3 A B 4
B 1 , B 2 , B 3 and B 4 must add up to be of sequence 3. We further split into 3 cases, where a) 3 of B i has sequence 1 (1 with sequence 0), b) 1 of B i has sequence 2 and another with sequence 1, c) 1 of B i has sequence 3.
For a), there is a total of 4 possibilities with 2 × 2 × 2 × 1 = 8 combinations. For b), there is a total of 4 × 3 = 1 2 possibilities with 3 × 2 × 1 × 1 = 6 combinations. For c), there is a total of 4 possibilities with 4 × 1 × 1 × 1 = 4 combinations. Summing them, we have 8 × 4 + 1 2 × 6 + 4 × 4 = 1 2 0 combinations.
4 HT-pairs: B 1 A B 2 A B 3 A B 4 A B 5
B 1 , B 2 , B 3 , B 4 and B 5 must add up to be of sequence 1. There are 5 ways of doing so, when one of B i has sequence 1. Therefore there are 5 × 2 = 1 0 combinations.
2 HT-pairs:
Since there is a total of 512 combinations, there are 512 - (10 + 120 + 120 + 10) = 2 5 2 combinations of 2 HT-pairs.
We can now calculate the variance.
V a r ( X ) = i = 1 ∑ 5 ( p i ( x i − μ ) 2 )
μ = 5 1 2 1 0 × 0 + 1 2 0 × 1 + 2 5 2 × 2 + 1 2 0 × 3 + 1 0 × 4 = 2
Therefore, V a r ( X ) = 5 1 2 1 0 ( 0 − 2 ) 2 + 5 1 2 1 2 0 ( 1 − 2 ) 2 + 5 1 2 2 5 2 ( 2 − 2 ) 2 + 5 1 2 1 2 0 ( 3 − 2 ) 2 + 5 1 2 1 0 ( 4 − 2 ) 2 = 8 5
This is probably an invalid solution, but I "flipped a coin" 9 times and then counted the number of HTs using python, 10 million times. I then calculated the variance using the 10 million values. The resulting variance was within .0001 of .625, which is equal to 5/8, and the sum is 13.
the rule is: "when head appear at one tossed, it must be head after the end tossed."
for the first we have to find the frequency for the case below: 1. no head following by tail : using the rule, total possibility is 10 that is no head, one head until nine head.
exactly one head immediately following by tail (two place has been taken and there are two place to tossed after and before HT) : with the same idea, we have (1 8+2 7+3 6+4 5+5 4+6 3+7 2+8 1=120)
exactly two head immediately following by tail (four place has been taken and there is three place to tossed there are before, between and after the two HT) : with the same idea we have (3 (1 1 6)+6 (1 2 5)+6 (1 3 4)+3 (2 2 4)+3 (2 3*3)=252)
exactly three head immediately following by tail: the last case is more easy to counting.
exactly four head immediately following by tail (8 place has been taken and there is 5 place to tossed there are before, between and after the two HT) : with the same idea we have (2 1 1 1 1+1 2 1 1 1+1 1 2 1 1+1 1 1 2 1+1 1 1 1 2=10); so the frequency for case four have to : 2^9-10-120-252-10=120
the average of the case : (10 0+120 1+252 2+120 3+10 4)/2^9=2 the varians of the case : (10 (0-2)^2+120 (1-2)^2+252 (2-2)^2+120 (3-2)^2+10 (4-2)^2)/512=5/8 so a+b=13
Problem Loading...
Note Loading...
Set Loading...
Let I i , i = 1 to 8 be the indicator variable that the i t h coin is H and the i + 1 t h coin is T . Specifically, I i = 1 when the i t h coin is H and the i + 1 t h coin is T , and I i = 0 otherwise. Then, X = I 1 + I 2 + … + I 8 .
We can calculate that E ( I i ) = 4 1 ⋅ 1 + 4 3 ⋅ 0 = 4 1 and Var ( I i ) = 4 1 ( 1 − 4 1 ) 2 + 4 3 ( 0 − 4 1 ) 2 = 1 6 3 . For j > i + 1 , the coins flips of the i t h , i + 1 t h , j t h and j + 1 t h coins are independent, so Cov ( I i , I j ) = 0 . If j = i + 1 , then I i I j = 0 , so Cov ( I i , I j ) = E [ I i I j ] − E [ I i ] E [ I j ] = 0 − 4 1 ⋅ 4 1 = − 1 6 1 . We then calculate
Var ( X ) = Var ( I 1 + I 2 + … + I 8 ) = i ∑ Var ( I i ) + j = i + 1 ∑ 2 Cov ( I i , I j ) + j > i + 1 ∑ 2 Cov ( I i , I j ) = 8 ⋅ 1 6 3 + 7 ⋅ 2 ⋅ ( − 1 6 1 ) + 0 = 8 5
Thus, a + b = 5 + 8 = 1 3 .