Closed form of this arithmetic series? I am computing the partial sums $s_{nn}$ of a series given by 
$a_{ij} = {1 \over 2}^{j-i}$ if $j>i$, $a_{ij} = -1$ if $j=i$ and $a_{ij} = 0$ if $j < i$
The $s_{nn}$ is the partial sum $\sum_{i,j =1}^n a_{ij}$. I computed that $$s_{nn}=\sum_{k=1}^{n-1} (n-k) {1 \over 2^k}$$
and now I am trying to find a closed formula for $s_{nn}$ but I'm stuck. Please can someone help me how to do this? 
 A: Hint: $s_{nn}$ is decomposed to $A_n=n\sum_{k=1}^{n-1}\frac1{2^k}$ and $B_n=-\sum_{k=1}^{n-1}\frac k{2^k}$. $A_n$ is geometric series and $B_n$ can be converted to geometric series by considering $2B_n-B_n$.
To expand $2B_n-B_n$, note that
$$\begin{align}&\frac1{2^1}+\frac2{2^2}+\frac3{2^3}+\cdots+\frac{n-2}{2^{n-2}}+\frac{n-1}{2^{n-1}}\\
-\frac1{2^0}-&\frac2{2^1}-\frac3{2^2}-\frac4{2^3}-\cdots-\frac{n-1}{2^{n-2}}\\
=-\frac1{2^0}-&\frac1{2^1}-\frac1{2^2}-\frac1{2^3}-\cdots-\frac{1}{2^{n-2}}+\frac{n-1}{2^{n-1}}\end{align}$$
A: Hint Differentiating the geometric series identity, we have
$$1+x+\cdots +x^n= \frac{x^{n+1}-1}{x-1}\implies1+2x+3x^2+\cdots +nx^{n-1}= \frac{d}{dx}\left( \frac{x^{n+1}-1}{x-1}\right)=\frac{(n+1)x^n (x-1)-x^{n+1}+1}{(x-1)^2}$$
Put $x=\frac{1}{2}:$
$$
1+2\left( \frac{1}{2}\right)+3\left( \frac{1}{2}\right)^2+\cdots +n \left( \frac{1}{2}\right)^{n-1}=4-\frac{n+2}{2^{n-1}}
$$
A: Assuming your expression $s_{nn} = \sum_{k=1}^{n-1} (n-k) {1 \over 2^k}$ is correct, I work from there.
$$s_{nn} = \sum_{k=1}^{n-1} (n-k) {1 \over 2^k} = n \sum_{k=1}^{n-1}{1 \over 2^k} - \sum_{k=1}^{n-1}{k \over 2^k}$$
As the first term is clearly a geometric series, I focus on the latter term.
$$ \sum_{k=1}^{n-1}{k \over 2^k} = \frac{1}{2} + (\frac{1}{4} + \frac{1}{4}) + (\frac{1}{8} + \frac{1}{8} + \frac{1}{8}) + \cdot \cdot \cdot + \frac{n-1}{2^{n-1}} $$
$$ \sum_{k=1}^{n-1}{k \over 2^k} = (\frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \cdot \cdot \cdot + \frac{1}{2^{n-1}}) + (\frac{1}{4} + \frac{1}{8} + \cdot \cdot \cdot + \frac{1}{2^{n-1}}) + (\frac{1}{8} + \cdot \cdot \cdot + \frac{1}{2^{n-1}}) + \cdot \cdot \cdot + \frac{1}{2^{n-1}} $$
Which is a sum of geometric series. Plugging in the closed form expression for each individual series will result in another geometric series, finally providing the partial sum.
