In order to calculate the $\text{E}[X]$ where $X$ is the number of total coin flips, this is the approach I took:

The probabilities are:

$Pr(H) = p$

$Pr(T) = (1-p)$

Define indicator random variables:
$H_i$ = 1 if $i$'th flip is heads = 0 if $i$'th flip is tails

$T_i$ = 1 if $i$'th flip is tails = 0 if $i$'th flip is heads

Now, there are two possible events that could occur:

$A =\{\ H ...TTT...H \}\ ~~~~or~~~~~B=\{\ H ...TTT...H \}$

so $\text{E}[X] = Pr(A)\cdot \text{E}[A] + Pr(B)\cdot \text{E}[B]$.;

$\text{E}[A]=\sum_{k=1}^\infty Pr(H_i)\cdot \text{E}[H_{i}]=\sum_{k=1}^\infty pkp^k = p\sum_{k=1}^\infty kp^k$ $\text{E}[B]=\sum_{k=1}^\infty Pr(T_i)\cdot \text{E}[H_{i}]=\sum_{k=1}^\infty (1-p)k(1-p)^k =(1-p) \sum_{k=1}^\infty kp^k$

Is this right so far? Because I'm hinted that I should get and use the formula for $\sum_{k=1}^\infty kx^{k-1}$, but I don't understand why there should is a $k-1$ as an exponent. Where did the $-1$ come from?

  • $\begingroup$ Do you mean, "What is the expected number of coin flips, if you stop when a coin flip is the same as the last?"? Also, please add the [self-study] tag & read its wiki. $\endgroup$ Dec 15, 2014 at 0:30
  • $\begingroup$ @Timmy A similar question has been asked on math, you mind find it helpful: math.stackexchange.com/questions/364038/… $\endgroup$
    – mugen
    Dec 15, 2014 at 0:40
  • $\begingroup$ Your A and B events are identical. I presume you want to interchange H and T on one of them $\endgroup$
    – Glen_b
    Dec 15, 2014 at 0:56

1 Answer 1


A few days have passed, so it's probably okay to give bigger hints (in spite of the OP not really fixing up the question as requested).

  1. You can never stop on the first flip. In fact it merely serves to identify which face counts as a "success" in later flips.

  2. After the first toss, we're looking for the number of tosses to the first success. This is a standard problem which is solved in any number of texts (but which I imagine you've also covered in class or as an exercise).

So the success-defining toss in "1." adds 1 to the standard problem "what's the total number of tosses to the first success"; which itself can be thought of as 1 more than "what's the total number of failures to the first success?".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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