I will explain question by example. I throw coin 100 times. What is the probability I get one or more series of 8 or more heads in a row?

Which theorem should I use?

Is there a equation for this kind of experiments?

I tried looking towards to Bernoulli distribution but still no clue.

There are similar questions for little different problems:

Expected number of coin tosses to get N consecutive, given M consecutive

Consecutive Coin Toss with static tosses

This one is really close: 3 heads in a sequence when a fair coin is tossed 5 times but does not give theoretical explanation I am looking for.

**Contents**hide

#### Best Answer

Consider the problem as a Markov chain with states for: 0, 1, …, 7 heads at the end of the string, and a state for 8 heads seen in a row. Design the transition matrix such that seeing a tail with probability half sends you back to state 0, and otherwise with probability half advances you to the next state (the final state is an absorbing state). Raise this matrix to the $n$th power. The value in the first row, and last column is the probability of seeing 8 heads in a row. In Python:

`import numpy as np a = np.zeros((9, 9)) for i in range(8): a[i, 0] = a[i, i + 1] = 0.5 a[8, 8] = 1.0 print(np.linalg.matrix_power(a, 100)[0, 8]) `

gives 0.170207962419. Using the Fraction type gives an exact answer of 6742632053880245534447059849/39614081257132168796771975168.

### Similar Posts:

- Solved – Probablity of getting sequence of K equal results while tossing coin N times
- Solved – Using Bayes Theorem to calculate the probability of a coin being biased given a specific test outcome
- Solved – Explain intuition regarding probability of “next flip” when tossing a fair coin
- Solved – Explain intuition regarding probability of “next flip” when tossing a fair coin
- Solved – Explain intuition regarding probability of “next flip” when tossing a fair coin