Hacker News new | past | comments | ask | show | jobs | submit login

For x < 1, 1 + 2x + 3x^2 + 4x^3 + ... converges to 1/(1-x)^2. When x = 0.001, you get 1/.999^2 = 1000000/998001 = 1.002003004005...



Here is a more detailed explanation

1---------

If x = 0.001 then the sum x^2 + 2x^3 + 3x^4…. in its decimal places will have all the three digit numbers except the the second last starting with 000,001 and then till 997,999.

As pointed out by someone below,the reason 998 is missing is because after 997998999 the next coefficient is 1000.This overflow 1 will carry over and mess up all the nines to the right until it hits the eight at which point it will make it a 9.Therefore the series will become 997999000001002003... as subsequent overflows keep messing up the last digit to the left.During the addition of the 2000th term a similar thing will happen and the series at that location will become ...997999001002003...... and it will keep losing a term from the beginning in the subsequent 998 repetitions.

More generally if x = 10^-n,n>0 then the sum x^2 + 2x^3 + 3x^4 will have all the n digit numbers starting with (n-zeroes),(n-1 zeroes 1)…except the second last (10^n-2).

2---------

From http://en.wikipedia.org/wiki/Geometric_series

An infinite geometric series converges to a/(1-r) if and only if the absolute value of r is less than 1.

a + ar^2 + ar^3 .... = a/(1-r) if |r|<1 -------> [1]

3---------

1 + 2x + 3x^2.....

= (1) + (x+x) + (x^2+x^2+x^2)....

= (1+x+x^2...) + (x+x^2+x^3...) + ...

= 1/(1-x) + x/(1-x) + (x^2)/(1-x) + .... since x < 1 from [1]

= (1+x+x^2....)/(1-x)

= 1/(1-x)^2 since x < 1 from [1] ---------> [2]

4---------

So the number 0.000001002003004……997999000001002003....

= (x^2 + 2x^3 + 3x^4…..) , x = 0.001

= (x^2) * (1 + 2x + 3x^2 …..)

= (x^2)/((1-x)^2)

= (0.001)^2/(0.999)^2

= ((1/999))^2

= 1/998001

More generally the sum which has all the n digit numbers except (10^n-2) in its decimal places is given by (10^n-1)^(-2).


A quicker proof is to just differentiate. For |r| < 1, we have

    1 + r + r^2 + ... = 1/(1-r)
Differentiate both sides of the equation:

    1 + 2r + 3r^2 + ... = 1/(1-r)^2
Here's a bijective combinatorial proof, which I like best of all. It uses the concept of generating functions. As a caveat, it only shows the equality for formal power series, not analytic power series.

The series 1 + r + r^2 + ... = 1/(1-r) is the type of tuples with entries in r. Then 1/(1-r)^2 is the type of pairs of tuples (the tuples in a pair need not have the same length). A pair of tuples can be mapped to a single tuple by concatenation. Conversely, a single tuple can be split into a pair of tuples. How many ways can this splitting be done if the tuple has length n? In n+1 ways; for example, the 2-tuple (a,b) can be split into the 3 pairs of tuples ((a,b), ()), ((a), (b)) and ((), (a, b)), which are exactly the pairs that concatenate to (a,b). Thus the bijection from 1 + 2r + ... + (n+1) r^n + ... to 1/(1-r)^2 maps an element of (n+1) r^n, which is an index 0 <= k <= n and an n-tuple, to the pair of tuples gotten from splitting that n-tuple at index k.


Here's yet another proof. This one uses probability theory.

Let's warm up with a probabilistic proof of

    1 + p + p^2 + ... = 1/(1-p)
in the form

    (1-p)(1 + p + p^2 + ...) = 1
This says that if you have a Bernoulli process with failure probability p and success probability 1-p, you will eventually succeed with probability 1. Indeed, (1-p) p^n is the probability that you will succeed after n failures.

To see this is true (it is certainly intuitively plausible), note that the probability of taking longer than n tries is p^n, which goes to zero as n goes to infinity.

We can apply the same kind of reasoning to

    (1-p)^2 (1 + 2p + 3p^2 + ...) = 1
As before, we have a process with failure probability p and success probability p-1. However, rather than stopping after the first success, we will continue until we have two successes. Now take a look at the terms of the equation's left-hand side:

    (1-p)^2 (n+1) p^n
This is the probability that we will have gotten 2 successes (and hence n failures) after n+2 steps. The second success must always be the final trial, so there are n+1 possible positions for the first success. That explains the factor of n+1.

With that understood, the equation simply says that we will eventually get 2 successes with probability 1. To see why, note that the probability of never getting any successes in n tries is p^n as before, which tends to zero. So we will eventually get at least one success with probability 1. But once we have that first success, getting the second success is just our first problem repeated, so we know that happens eventually with probability 1.

This proof technique generalizes easily. If we keep trying until we have 3 successes, we get a factor of C(n+2, 2) = (n+2)(n+1)/2 for the number of ways the first 2 successes can be placed before the third and final success when there are n failures and 3 successes. We show that a first success occurs eventually with probability 1 as before, which reduces the problem to getting two subsequent successes, a problem we already solved.

You can see this yields a proof by induction for this whole class of series identities, but it's not of those unenlightening proofs by induction that shows you something is true but does not tell you why.


Thanks ...the differential proof is very insightful and perhaps says something about differentiation itself.

EDIT 1: Forgive my ignorance but can you please elaborate on

1 + r + r^2 + ... = 1/(1-r) is the type of tuples with entries in r ?

EDIT 2: Okay I think I get it.

1 + r + r2 are the terms in the expansion of (1+r)n


It does say something important about differentiation, which shows up very clearly and explicitly in the theory of generating functions and combinatorial species, and relates to my second proof. When you differentiate a type, you get the type of its splittings or what Conor McBride calls its one-hole contexts.

> >1 + r + r^2 + ... = 1/(1-r) is the type of tuples with entries in r ?

r^n is the type of n-tuples with entries in r. When you sum over all n, you get the type of tuples of any length with entries in r.

One thing that might be confusing you is that I'm thinking of r itself as a type, not as a number. You get a number from a type by counting its elements, but a type has much more structure than just its size.


Thanks. That's really cool.


Here's a similar derivation (assuming |x| < 1), applying the geometric summation twice in the last two steps, but presented a bit more visually:

    x + 2x^2 + 3x^3 + 4x^2..

    =

    x +  x^2 +  x^3 + x^4 + ...
      +  x^2 +  x^3 + x^4 + ...
             +  x^3 + x^4 + ...
                    + x^4 + ...

    = sum i from 0 to infinity (sum j=i to infinity (x^j)) 

    = sum i from 0 to infinity ((x^i)/(1-x))

    = 1/(1-x)^2




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: