<s>[INST] How do you derive the following two summations? 

I tried using the geometric series formula, $$ \sum_{n=0}^{k-1} ar^{n}=a\left (\frac{1-r^{n}}{1-r} \right ) $$, but I got $1-2\left ( \frac{1}{2}^{n-1} \right )$ for the first one and $2-2\left ( \frac{1}{2}^{n-1} \right )$ for the second.
Edit: I derived the first answer by doing $1\cdot \frac{1-\left (\frac{1}{2}\right)^{n-1}}{1-\frac{1}{2}}$, which results in $2\cdot\left(1-\left (\frac{1}{2}\right)^{n-1} \right)$ = $2-2\left (\frac{1}{2}\right)^{n-1}$. Since it starts out as n=1, I did $2-2\left (\frac{1}{2}\right)^{n-1}-1$, so the final answer I got is $1-2\left ( \frac{1}{2}^{n-1} \right )$
 [/INST] $\sum_{n=0}^{n-1}a\left (\frac{1-r^{n}}{1-r} \right ) = 
\frac {a(n-1)}{1-r}- \frac{1}{1-r}\sum_{n=0}^{n-1} r^n $ 
$=\frac {a(n-1)}{1-r}- a\frac{(1-r^n)}{(1-r)^2}$   [by multiplying by $\frac{1-r}{1-r}$]
</s>