# Learning how summations work

Before, I begin I want say that the original question asks, "A couple decides to continue to have children until a daughter is born. What is the expected number of children until a daughter is born?"

Below, is the solution that they had in the back of the textbook (Statistical Inference, Second Edition, Roger L. Berger, George Casella) What I do not understand is how to deduce summations that well.

First of all, how do they get $$\sum^\infty_{k=1}k(1-p )^{k-1}p = p - \sum^\infty_{k=1}\frac{d}{dp}(1-p )^{k}$$

Next, How do they simplify this as well $$-p\frac{d}{dp}{\bigg[\sum^\infty_{k=0}(1-p)^k-1\bigg]} = -p\frac{d}{dp}\bigg[\frac{1}{p}-1\bigg] = \frac{1}{p}$$

I would like this to be shown and explained intuitively because the statistics course I am taking requires me to be able to deduce summations on my own, and it seems to be a huge part of understanding the subject. Thank you ahead of time.

• the answer is: you see that, if you've practiced enough :( sorry! It's really like that. For the first question, there might be other ways to arrive at $\frac1p$, but the path they chose here is "I see a term to the power of something minus one, that times that something – that looks like a derivative", and that's it. It's an Ansatz they tried and that worked. Note that this has exactly nothing to do with your question's title! – Marcus Müller Jul 21 at 19:05
• It is just crazy how I am expected to know how to answer that. I found the solution online, but my instructor just wanted me to answer the question and show my work. I do not know how I am expected to do that when this is my first stats class :/ – Alexander Martinez Jul 21 at 19:10
• the best advice is tp grab a calculus text book and look at the chapter on Taylor series and practice. If you aren’t a little familiar with doing manipulations yourself it’ll be hard to see them in the wild. Geometric series and integrating/differentiating them are especially useful – Nap D. Lover Jul 21 at 19:11
• your not expected to know how to answer this from your first stats class alone; this is usually exercised, a lot, in "higher maths for XYZ" or "calculus" courses that you have before stats. – Marcus Müller Jul 21 at 19:11

As an alternate method that does not require the use of Geometric Series:

Let $$E$$ denote the answer, then consider the possible outcomes from the first child. Either the child is a daughter ($$p$$) in which case the answer is $$1$$ or it is a son ($$1-p$$) and the answer is now $$1+E$$.

Thus $$E=p\times 1 + (1-p)\times (E+1)\implies E=\frac 1p$$

In general, the use of Geometric Series only makes sense in those situations (as here) in which one can easily enumerate all the possible outcomes. Generally speaking, however, this is not possible.

This is a long-winded comment that is intended as a supplement to the other already posted responses. This is not an answer.

The foundation of the geometric series is the idea that for any real number $$x \neq 1$$, and any positive integer $$n$$, you have that

$$\left(1 + x + x^2 + \cdots + x^n\right) \times (1 - x) = \left[1 - x^{(n+1)}\right]. \tag1$$

Formulas around geometric series are all based on equation (1), above.

For example, from equation (1), you have that

$$\left(1 + x + x^2 + \cdots + x^n\right) = \frac{1 - x^{(n+1)}}{1 - x}. \tag2$$

Now, for $$~x \neq 1, ~n \in \Bbb{Z^+},~$$ let $$E_n(x)$$ denote $$\displaystyle \frac{x^{(n+1)}}{1 - x}$$.

Then you have that

$$\left(1 + x + x^2 + \cdots + x^n\right) = \frac{1}{1 - x} - E_n(x). \tag3$$

This means that when $$\displaystyle \left(1 + x + x^2 + \cdots + x^n\right)$$

is estimated as $$\displaystyle \frac{1}{1-x}$$, then $$E_n(x)$$ is the error term in the estimation.

Therefore, a natural question to ask is :
as $$n \to \infty$$, for which values of $$x$$ will $$E_n(x)$$ go to $$(0)$$?
[Denote this question as Q1].

Note that since fixed values of $$x \neq 1$$ are being considered, question Q1 is equivalent to asking: as $$n \to \infty$$, for which values of $$x$$ will $$x^{(n+1)}$$ go to $$(0)$$?
[Denote this question as Q2].

It is an intermediate result in Real Analysis (AKA Calculus) that the answer to question Q2 is that
as $$n \to \infty, ~x^{(n+1)} \to (0) \iff |x| < 1.$$

What this implies is that for any $$|x| < 1,$$ the error term in equation (3) above will go to $$(0)$$ as $$n \to \infty.$$

This implies that for all $$|x| < 1,$$ you have that $$\displaystyle \lim_{n \to \infty} \sum_{k=0}^n x^k = \frac{1}{1-x}.$$

First of all, how do they get $$\sum^\infty_{k=1}k(1-p )^{k-1}p = p - \sum^\infty_{k=1}\frac{d}{dp}(1-p )^{k}$$

By way of a typo. That is not what they should get.

\begin{align}\sum^\infty_{k=1}k(1-p )^{k-1}p ~&=~ p\sum_{k=1}^\infty k(1-p)^{k-1}\\ &=~-p\sum_{k=1}^\infty \dfrac{\mathrm d (1-p)^k}{\mathrm d p}\\[3ex]&=~-p\dfrac{\mathrm d ~~}{\mathrm d p}\left(\sum_{k=1}^\infty(1-p)^k\right)\\&=~-p\dfrac{\mathrm d ~~}{\mathrm d p}\left(\sum_{k=0}^\infty(1-p)^k-(1-p)^0\right)\\&=~-p\dfrac{\mathrm d ~~}{\mathrm d p}\left(\dfrac 1p-1\right)\\&=~-p\left(-\dfrac 1{p^2}\right)\\&=\dfrac 1p \end{align}

Next, How do they simplify this as well $$-p\frac{d}{dp}{\bigg[\sum^\infty_{k=0}(1-p)^k-1\bigg]} = -p\frac{d}{dp}\bigg[\frac{1}{p}-1\bigg] = \frac{1}{p}$$

By way of change of variables. When $$\lvert 1-p\rvert \leqslant 1$$ (which it is because $$p$$ is a probability measure), then the series converges and so we have:

\begin{align}\sum_{k=0}^\infty (1-p)^k~&=\sum_{j=0}^\infty (1-p)^j\\&=~(1-p)^0+\sum_{j=1}^\infty (1-p)^j\\&=~1+\sum_{k=0}^\infty (1-p)^{k+1}\\&=~1+(1-p)\sum_{k=0}^\infty (1-p)^k\\\therefore\quad(1-(1-p))\sum_{k=0}^\infty (1-p)^k~&=~1\\\sum_{k=0}^\infty(1-p)^k~&=~\dfrac 1p\end{align}