Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A Coin with Probability of heads $p$ is continously flipped till the sequence $THT$ occurs.Find the Expected number of coin flips.

My Try: if $X$ is number of coin flips till $THT$ occurs, $X$ can take values of $3$, $4$,$5$,$\cdots$


For $X=4$ the Sample space is $HTHT$ or $TTHT$


For $X=5$ the Sample space is $HHTHT$ or $HTTHT$ or $TTTHT$

$$P(X=5)=(p^2-p+1)(1-p)^2p$$ But i feel the process becomes tedious as $X$ increases. Please suggest me any hint...

share|cite|improve this question
See this answer also:… – gar May 3 '14 at 11:30
Got something from the answer below? – Did May 8 '14 at 9:10

Consider the set of prefixes of the word $tht$, that is, the set $\{o,t,th,tht\}$ where $o$ denotes the empty prefix. For every prefix $w$ let $m_w$ denote the mean number of draws needed to produce the word $tht$ starting from a sequence of draws which ends by $w$ but not by any longer prefix.

Thus, $m_{tht}=0$ and the question is to compute $m_o$. Let $q=1-p$. The usual one-step decomposition yields the identities $$ m_o=1+pm_o+qm_t,\quad m_t=1+pm_{th}+qm_t,\quad m_{th}=1+pm_o, $$ and solving this affine system yields $$ m_o=\frac1q+\frac1{pq^2}. $$ An approach to compute the mean time necessary to produce any word $w$ in terms of the structure of its prefixes (and an explanation of the formula above) is in the book DNA, Words And Models by Robin, Rodolphe, and Schbath. The authors explain why this mean time is the sum of the inverses of the probabilities of each prefix of $w$ which is also a suffix of $w$. When $w=tht$, these prefixes-suffixes are $tht$ and $t$, whose probabilities are $pq^2$ and $q$ respectively, hence the formula above.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.