<s>[INST] A sequence is defined by $f(x) = 4^{x-1}$, find the sum of the first $8$ terms. A sequence is defined by $f(x) = 4^{x-1}$, find the sum of the first $8$ terms.
$\dfrac{a(1-r^n)}{1-r}$
$\dfrac{1(1-4^7)}{1-4} = 5461$.
The answer in the book is $21845$. How is this so?
Thank you
 [/INST] The sum of the first $n$ terms of a geometric sequence $\{a_n\}$ with initial term $a_1$ and common ratio $r$ is $$s_n = a_1\frac{1 - r^{n}}{1 - r}$$  
For the sequence defined by $f(n) = 4^{n - 1}$, $a_1 = 4^{1 - 1} = 4^0 = 1$, and $$r = \frac{a_{n + 1}}{a_n} = \frac{4^n}{4^{n - 1}} = 4$$  You wish to find the sum of the first eight terms of the sequence, so $n = 8$.  Thus, you should obtain
$$s_8 = 4^0 + 4^1 + 4^2 + 4^3 + 4^4 + 4^5 + 4^6 + 4^7 = 1 \cdot \frac{1 - 4^8}{1 - 4} = 21845$$
Derivation:  If a geometric sequence $\{a_n\}$ has initial term $a_1$ and common ratio $r$, the first few terms of the sequence are $\{a_1, a_1r, a_1r^2, a_1r^3, \ldots\}$.  In general, the $n$th term of the sequence is $a_1r^{n - 1}$.  The sum of the first $n$ terms of the sequence is 
$$s_n = a_1 + a_1r + a_1r^2 + \cdots + a_1r^{n - 1}\tag{1}$$
Hence, 
$$rs_n = a_1r + a_1r^2 + a_1r^3 + \cdots + a_1r^{n - 1} + a_1r^n\tag{2}$$
Subtracting equation 2 from equation 1 yields
$$(1 - r)s_n = a_1 - a_1r^n = a_1(1 - r^n)$$
If $r \neq 1$, then 
$$s_n = a_1\frac{1 - r^n}{1 - r}$$
If $n = 1$, then the sequence is constant, with $a_n = a_1$ for each $n \in \mathbb{N}$, so the sum of the first $n$ terms of the sequence is $s_n = na_1$.
</s>