I stared at this for longer than I'd like to admit.
Use linearity of expectation by defining indicator variables for each toss that starts a new streak. For the fair coin, each toss after the first has probability 1/2 of starting a streak, so the expected number is 1 + 999*(1/2) = 500.5. For general p, the probability that a toss starts a streak is 2p(1-p), so the expected number is 1 + 999*2p(1-p).
Pro tip: Emphasize that linearity of expectation holds regardless of dependence between indicator variables, which is key here since streak starts are not independent. Also, sanity-check the result: for p=0.5, it matches the fair coin case, and for p=0 or 1, it gives 1 streak.
Let X_i be 1 if a new streak starts at toss i, for i=1,...,1000. Note X_1=1 always.
For i>1, a new streak starts if toss i differs from toss i-1. For fair coin, P(X_i=1)=1/2. For general p, P(X_i=1)=P(H then T)+P(T then H)=p(1-p)+(1-p)p=2p(1-p).
The expected number of streaks is E[sum X_i] = sum E[X_i] = 1 + 999 * P(X_i=1).
For fair coin: 1 + 999*(1/2) = 500.5. For general p: 1 + 999*2p(1-p).
Verify edge cases: p=0.5 gives 500.5, p=0 or 1 gives 1, and the maximum occurs at p=0.5. Discuss implications for data science.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.