Derive expectation for two consecutive heads
LinkedInData Scientist · Technical ScreenLast updated
This question evaluates mastery of probability theory and stochastic processes, specifically expectation and variance calculations, Markov-chain or recurrence reasoning, and pattern waiting times in Bernoulli trials relevant for a Data Scientist role.
Let T be the number of fair coin flips until the pattern HH (two consecutive heads) appears for the first time. (a) Derive E[T] using a state-based recursion or Markov-chain argument and give the exact numeric value. (b) Generalize E[T] for a biased coin with P(H) = p (0 < p < 1). (c) For the fair coin, derive Var(T). State all steps and justify your recurrence setup.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.