# Exponential function 2^x-sum.

1. Oct 1, 2011

### Bassalisk

I posted a related thread, in the same forum regarding matlab, but I want to discuss this here separately.

Few minutes ago I became very confused baffled and surprised at the same time.

consider function $2^{x}$.

Now consider the sum of this function for n iterations.(from 0 to n)

$\sum_{x=0}^n 2^{x}$.

Using my humble knowledge of c++ I found that you need 19 iterations (including zero as iteration) for a number 524287.

so 1+2+4+8+16...+262144=524287

By case, found that this sum is 1 less than the $2^{19}$.

so $524287=2^{19}-1$

Why? I am not best mathematician you will come across but this i found very interesting.

2. Oct 1, 2011

### Charles49

The binomial theorem states that
$$(x+y)^n = \sum_{k=0}^n {n \choose k}x^{n-k}y^k = \sum_{k=0}^n {n \choose k}x^{k}y^{n-k}.$$

Now set, x=1 and y=1.

3. Oct 1, 2011

### Bassalisk

I don't think I understand.

General rule I got out of my numbers is:

$\sum_{i=0}^n 2^{i}=2^{n+1}-1$

By putting zeros into my binomial equation i get:

$2^n =1+ \sum_{k=1}^n {n \choose k}1^{n-k}1^k=1+\sum_{k=1}^n {n \choose k}$

How do I relate factorial formula to $\sum_{i=0}^n 2^{i}$

4. Oct 1, 2011

### AlephZero

This is an example of a "geometric seriies" (google will find lots of web pages). It is a bit of a "special case" because you used 2 as the multiplying factor.

In general, suppose you have a sum
$$S = 1 + x + x^2 \cdots + x^{n-1}$$
You can multiply both sides by x to get
$$Sx = x + x^2 + x^3 + \cdots + x^n$$
Now subtract the first sum from the second one. All the terms in the sums cancel out except for the first and last ones, and you get
$$Sx - S = S(x-1) = x^n -1$$
When $x = 2$ the result is even simpler because $x-1 = 1$, and you get
$$1 + 2 + 2^2 ... + 2^{n-1} = 2^n - 1$$

BTW I don't really understand what the Binomial theorem has to do with this either.

5. Oct 1, 2011

### Bassalisk

This makes sense. Thank you !!