# Thread: help with math question

1. ## help with math question

2. Originally Posted by tukilala
That is: prove that $\sum_{i= 0}^{log_2(n-1)} 2^i= n-1$
Did your try this with n= 1, 2, 3, etc. first? If n= 1, n-1= 0 and $log_2(0)$ is not defined. if n= 2, $log_2(1)= 0$ so that sum is $2^0= 1= 2-1$. If n= 3, $log_2(2)= 1$ so the sum is $2^0+ 2^1= 1+ 2= 3\ne 3-1$.
In order for that sum to make sense, n-1 must be a power of 2 so n must be one more than a power of 2. For example, if n= 5, n-1= 4 and $log_2(n-1)= log_2(4)= 2$ so the sum is $2^0+ 2^1+ 2^2= 1+ 2+ 4= 7\ne 5- 1$.
You can't prove this- it is not true. What can be proven is that if n is a power of 2 (1, 2, 4, 8, etc.) then $\sum_{i=0}^{log_2(n)} 2^i= 2n-1$ or, more simply, $\sum_{i=0}^n 2^i= 2^{n+1}-1$.
If, for example, n= 5, then $ln_2(n-1)= ln_2(4)= 2$ so the sum is from 0 to 2: 1+ 2+ 4= 7 which is NOT equal no to n-1= 4. You can't prove it, it's not true.