How to find the closed formula for $\sum _{i=0}^n {i q^i}$? I'm having troubles solving the fourth item of this problem set. It's from an algebra class. I've managed to solve the previous three, but I can't seem to figure out how to tackle the last one. 
$$\text{i})\sum^n_{i=1}q^i \qquad \qquad \quad \text{ii})\sum^n_{i=0}q^{2i} \qquad \qquad \quad \text{iii})\sum^{2n}_{i=n}q^i \qquad \qquad \quad\text{iv})\sum^n_{i=0}(n-i)q^{i}$$
More precisely I don't know how to solve the following sum: 
$$\sum _{i=0}^n {i  q^i}$$
Thanks for your hints and suggestions!
 A: Use the fact that $\frac{q^{n+1} - 1}{q-1} = \sum_{i=0}^n q^i$. Now derivate from both sides wrt q and the multiply by $q$ and you will finally get your formula.
A: $$\begin{align}
(n+1)q^{n+1}+\sum_{k=0}^nkq^k & =\sum_{k=0}^{n+1}kq^k \\
& =\sum_{k=1}^{n+1}kq^k \\
& =\sum_{k=0}^n(k+1)q^{k+1} \\
& =\left(q\sum_{k=0}^nkq^k\right)+q\sum_{k=0}^nq^k \\
(n+1)q^{n+1}+\sum_{k=0}^nkq^k & =\left(q\sum_{k=0}^nkq^k\right)+\frac{q(1-q^{n+1})}{1-q} \\
(n+1)q^{n+1} & =\left((q-1)\sum_{k=0}^nkq^k\right)+\frac{q(1-q^{n+1})}{1-q} \\
(q-1)\sum_{k=0}^nkq^k & = (n+1)q^{n+1}-\frac{q(1-q^{n+1})}{1-q} \\
\sum_{k=0}^nkq^k & = \frac{(n+1)q^{n+1}-\frac{q(1-q^{n+1})}{1-q}}{q-1}
\end{align}$$
A: It is useful to know a formula for $\sum_{i=1}^niq^i$. From "How to compute the  formula $\sum  \limits_{r=1}^d r \cdot 2^r$?", we have
$$\sum_{i=0}^niq^i=\frac{nq^{n+2}-q^{n+1}(n+1)+q}{(q-1)^2}$$
(you can prove this by induction, if necessary, or if you are allowed to use calculus you can use the same technique as in the link). Then
\begin{align*}
\sum_{i=0}^n(n-i)q^i&=n\sum_{i=0}^nq^i-\sum_{i=0}^niq^i=n\frac{q^{n+1}-1}{q-1}-\frac{nq^{n+2}-q^{n+1}(n+1)+q}{(q-1)^2}\\
&=\frac{n(q^{n+1}-1)(q-1)-nq^{n+2}+nq^{n+1}+q^{n+1}-q}{(q-1)^2}\\
&=\frac{n(q^{n+2}-q^{n+1}-q+1)-n(q^{n+2}-q^{n+1})+q^{n-1}-q}{(q-1)^2}\\
&=\frac{-n(q-1)+q^{n-1}-q}{(q-1)^2}
\end{align*}
A: Re-order the sum as follows:
\begin{align}
\sum_{i=0}^{n} (n-i) \, q^i &= n \, q^{0} + (n-1) \, q^{1} + \cdots + (1) \, q^{n-1} + (0) \, q^{n} \\
&= (0) \, q^{n} + (1) \, q^{n-1} + \cdots + n \, q^{0} \\
&= \sum_{i=0}^{n} i \, q^{n-i} \\
&= q^{n} \, \sum_{i=0}^{n} i \, q^{-i} = - q^{n+1} \, \frac{d}{dq} \left( \sum_{i=0}^{n} q^{-i} \right) \\
&= - q^{n+1} \, \frac{d}{dq} \left( \frac{1 - q^{-n-1}}{1 - q^{-1}} \right) \\
&= - q^{n+1} \, \frac{q^2}{(1-q)^2} \, \left[ (1-q^{-1})(n+1) \, q^{-n-2} - q^{-2} (1 - q^{-n-1}) \right] \\ 
&= \frac{q^{n+1} - (n+1) \, q + n}{(1-q)^2}
\end{align}
A: I have not seen a double sum here, so...
\begin{multline}
\sum_{i=0}^n(n-i)q^i=\sum_{i=0}^n\sum_{k=0}^{n-i-1}q^i
=\sum_{\substack{i,k\ge0\\i+k<n}}q^i
=\sum_{k=0}^{n-1}\sum_{i=0}^{n-k-1}q^i
=\\=\sum_{k=0}^{n-1}\frac{1-q^{n-k}}{1-q}
=\frac1{1-q}\left(n-\sum_{\ell=1}^{n}q^\ell\right)
=\frac1{1-q}\left(n-q\frac{1-q^n}{1-q}\right)
=\\=\frac{n-nq-q+q^{n+1}}{(1-q)^2}.
\end{multline}
A: You can use the following transformation:
$$\sum _{i=0}^n {i  q^i}=\sum _{i=1}^n {i  q^i}=\sum _{i=1}^n {(i-1+1)q^i}=q\sum _{i=1}^n {(i-1)q^{i-1}}+\sum _{i=1}^n {q^i}.$$
Hence
$$S=q(S-nq^n)+\sum _{i=1}^n {q^i}.$$
You should be able to conclude. (Mind the starting indexes.)

More visually:
$$\begin{align}S&=q+2q^2+3q^3+4q^4+\cdots\ \ \ \ \ \ \ \ \ \ \ \ nq^n\\
qS&=\ \ \ \ \ \ \ \ \ q^2+2q^3+3q^4+\cdots\ \ (n-1)q^{n-1}+nq^{n+1}\\
S-qS&=q+\ \ q^2+\ \ q^3+\ \ q^4+\cdots\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ q^n\ \ \ -nq^{n+1}\end{align}$$
