Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to prove a geometric progression formula that is related to the formula for the second moment of the geometric distribution. Specifically, I am wondering where I am going wrong, so I can perhaps learn a new technique.

It is known, and I wish to show: $$ m^{(2)} = \sum_{k=0}^\infty k^2p(1-p)^{k-1} = p\left(\frac{2}{p^3} - \frac{1}{p^2}\right) = \frac{2-p}{p^2} $$

Now, dividing by $p$ both sides, and assigning $a = 1-p$ yields: $$ \sum_{k=1}^\infty k^2a^{k-1}=\frac{2}{(1-a)^3}-\frac{1}{(1-a)^2} \qquad \ldots \text{(Eq. 1)} $$

I want to derive the above formula. I know: $$ \sum_{k=0}^\infty ka^{k-1}=\frac{1}{(1-a)^2} $$ Multiplying the left side by $1=\frac aa$, and multiplying both sides by $a$, $$ \sum_{k=0}^\infty ka^k = \frac{a}{(1-a)^2} $$ Taking the derivative of both sides with respect to $a$, the result is: $$ \sum_{k=0}^{\infty}\left[a^k + k^2 a^{k-1}\right] = \frac{(1-a)^2 - 2(1-a)(-1)a}{(1-a^4)} = \frac{1}{(1-a)^2}+\frac{2a}{(1-a)^3} $$ Moving the known formula $\sum_{k=0}^\infty a^k = \frac{1}{1-a}$ to the right-hand side, the result is: $$ \sum_{k=0}^\infty k^2 a^{k-1} = \frac{1}{(1-a)^2} + \frac{2a}{(1-a^3)} - \frac{1}{1-a} $$

Then, this does not appear to be the same as the original formula (Eq. 1). Where did I go wrong?

Thanks for assistance.

share|cite|improve this question
up vote 3 down vote accepted

You've actually almost arrived at the correct solution - your mistake is in the differentiation with respect to $a$ - the LHS is $\sum_{k=0}^{\infty}\left[a^k + k^2 a^{k-1}\right]$ instead of $\sum_{k=0}^{\infty}\left[k^2 a^{k-1}\right]$.

You're finished because $\frac{1}{(1-a)^2} + \frac{2a}{(1-a)^3} = \frac{a+1}{(1-a)^3} = \frac{2}{(1-a)^3} - \frac{1}{(1-a)^2}$.

EDIT: Here's some generalization: In general, $\sum_{n \ge 0} \binom{n}{k}x^n = \frac{x^k}{(1-x)^{k+1}}$, which is basically proved by differentiating $\sum_{n\ge 0} x^n=\frac{1}{1-x}$ $k$ times, multiplying by $x^k$ and dividing by $k!$.

From this one can calculate $\sum_{n \ge 0}n^k x^n$ by expressing $n^k$ as a combination of binomial coefficients: $n^k = \sum_{i=0}^{k} \binom{n}{i} a_{i,k}$. If you interpret $n^k$ as the number of functions from a $k$-set to an $n$-set, you realize that $a_{i,k}$ count the number of surjective function from a $k$-set to an $i$-set.

This allows you to compute the $k$'th moment of the geometric distribution quite easily, and it will always be of the form $\frac{f(p)}{p^k}$ where $f$ is a polynomial of degree $k-1$.

EDIT 2: It can be seen that $f(0)=a_{k,k}=k!, f(1)=a_{1,k} = 1$. This allows you to write $f(x)=x+k!(1-x)+(x-1)xg(x), \deg g < k-2$, which gives you the second moment immediately ($k=2$): $f(p)=p+2!(1-p)=2-p$.

In general, $f(p)=\sum_{i=1}^{k} a_{i,k} (1-p)^{i-1}p^{k-i}$. Note that you can express $a_{i,k}$ with Stirling numbers of the second kind: $a_{i,k}=i! \lbrace\textstyle{k\atop i}\rbrace= \sum_{j=0}^{i} (-1)^{i-j}\binom{i}{j}j^k$.

Compare with my edit to this answer.

share|cite|improve this answer
Interesting edits. I will keep trying to understand. – jrand Dec 28 '12 at 1:21
@jrand - I left some details for you to complete, of course. I fixed some typos. I can also elaborate on non-clear conclusion. – Ofir Dec 28 '12 at 6:36

You have $$\sum_{k=0}^{\infty} ka^k = \dfrac{a}{(1-a)^2}$$ Differentiating with respect to $a$ gives us $$\sum_{k=0}^{\infty} k^2 a^{k-1} = \dfrac{(1-a)^2 - a \times 2 \times (a-1)}{(1-a)^4} = \dfrac{1-a + 2a}{(1-a)^3} = \dfrac{a-1+2}{(1-a)^3}\\ = \dfrac2{(1-a)^3} - \dfrac1{(1-a)^2}$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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