# Chapter 11 - Analysis of Algorithm Efficiency - Exercise Set 11.4 - Page 764: 39

Prove $n+ \frac{n}{2} + \frac{n}{4} + \cdots + \frac{n}{2^n}$ is $\Theta(n)$. By theorem 5.2.3: $n+ \frac{n}{2} + \frac{n}{4} + \cdots + \frac{n}{2^n} = n(1+ \frac{1}{2} + \frac{1}{4} + \cdots + \frac{1}{2^n}) = n(\frac{(\frac{1}{2})^{n+1}-1}{\frac{1}{2}-1}) = n(\frac{1-2^{n+1}}{-2^n})$ (multiply numerator and denominator by $2^{n+1}$) $=n(\frac{2^{n+1}-1}{2^n}) = n(2-\frac{1}{2^n})$. For $n>1$, $1 \leq (2-\frac{1}{2^n}) \leq 2$ so $1(n) \leq n(2-\frac{1}{2^n}) \leq 2(n)$. By the transitive property: $1(n) \leq n+ \frac{n}{2} + \frac{n}{4} + \cdots + \frac{n}{2^n} \leq 2(n)$. Because all terms are positive: $1|(n)| \leq |n+ \frac{n}{2} + \frac{n}{4} + \cdots + \frac{n}{2^n}| \leq 2|(n)|$. Thus for A=1, B=2, k=1, $A|(n)| \leq |n+ \frac{n}{2} + \frac{n}{4} + \cdots + \frac{n}{2^n}| \leq B|(n)|$ for all $x>k$. Thus $n+ \frac{n}{2} + \frac{n}{4} + \cdots + \frac{n}{2^n}$ is $\Theta(n)$.

#### Work Step by Step

Recall the definition of $\Theta$-notation: $f(x)$ is $\Theta(g(x))$ iff there exist positive real numbers A, B, k, such that $A|g(x)| \leq |f(x)| \leq B|g(x)|$ for all $x>k$. Recall theorem 5.2.3: sum of a geometric sequence: For any real number $r$ except 1, and any integer $n \geq 0$, $\sum_{i=0}^{n}r^i = \frac{r^{n+1}-1}{r-1}$. In this case $r=\frac{1}{2}$.

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.