Flip a fair coin until you get the first "head". Let X represent the number of flips before the first head appears. Calculate E[X].

So I solved this problem and you get a power series:

$E[X] = 1*0.5 + 2*0.5^2 + 3*0.5^3+ ...$

This is basically of the form $\sum\limits_{i=0}^{\infty}x_i(0.5)^i.$

I flipped open my calculus book to review how to solve this series but I didn't find anything on how to calculate the limiting value for a power series, just the radius of convergence.

I see for a sum of infinite geometric series, the value is:

$S_n = a+ ax + ax^2 + ... + ax^n + ... = \cfrac{a}{1-x}$ for |x| < 1.

Can someone please tell me the general approach if there is one for a power series?

Thank you in advance.

  • 2
    $\begingroup$ Hint: Set $a=1$ and differentiate both sides of the expression $1+x+x^2+\cdots=\frac{1}{1-x}$. You will get something very close to what you want. $\endgroup$ Jul 14, 2013 at 4:40
  • $\begingroup$ Thank you @AndréNicolas! Is there anything that you don't know? $\endgroup$ Jul 14, 2013 at 4:52
  • $\begingroup$ Note that coincidentally essentially the same question was asked and answered 3 or 4 questions ago. $\endgroup$ Jul 14, 2013 at 5:04

2 Answers 2


The general approach to this kind of problem is to sum the series by repeated differentiation and multiplication. This should produce a solution to any series of the form $\sum_{n=0}^{\infty}n^k x^n$, and, therefore, any series of the form $\sum_{n=0}^{\infty}p(n)x^n$ . As an example, let's solve your specific series, $\sum_{n=0}^{\infty}nx^n$. To solve this, recall the formula for a simple geometric series:


Now, differentiate both sides with respect to x to get:


Next, multiply both sides by x, and we have:

$$\sum_{n=0}^{\infty}nx^{n}=\frac x{(1-x)^2}$$

Finally, substitute in $x=1/2$ to get $E[X]=2$, which is the correct result for the expectation of a geometric distribution with p=0.5.

Does that answer your question?

  • $\begingroup$ Yes thank you @logosintegralis!!!!!!!!!!!! $\endgroup$ Jul 14, 2013 at 4:51

We give an alternative way to do the calculation. The expectation exists, since the series converges. Let it be $a$. On your first toss, two things can happen: (i) You get a head, so $X=1$ or (ii) You get a tail, have wasted a toss, and your expected number of additional tosses is $a$. So with probability $0.5$, your expectation is $1$, and with probability $0.5$ it is $1+a$. It follows that $$a=(0.5)(1)+(0.5)(1+a).$$ Solve this linear equation for $a$. We get $a=2$.

Remark: We interpreted the phrase "before the first head appears" in the conventional sense, where the successful toss is counted. If we interpret before as meaning strictly before, the power series expression becomes a little nicer, and the mean turns out to be $1$.

  • $\begingroup$ I didn't understand this explanation, but your hint on differentiating helped me solve the problem. Thank you. $\endgroup$ Jul 14, 2013 at 4:56
  • $\begingroup$ The argument used what is called formally conditional expectation. If with probability $p$ your expectation is $c$, and with probability $1-p$ it is $d$, then the (unconditional) expectation is $pc+(1-p)d$. $\endgroup$ Jul 14, 2013 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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