<s>[INST] Prove by induction that $\frac{1}{2}+\frac{2}{2^2}+\frac{3}{2^3}+\cdots+\frac{n}{2^n}=2-\frac{n+2}{2^n}$ Prove by induction that 
$$
\frac{1}{2}+\frac{2}{2^2}+\frac{3}{2^3}+\cdots+\frac{n}{2^n}=2-\frac{n+2}{2^n}
$$
Let $n=r$, so that
$$
S_r=2-\frac{r+2}{2^r}
$$
Therefore
$$\begin{align}
S_{r+1}=S_r+\frac{r+1}{2^{r+1}}&=2-\frac{r+2}{2^r}+\frac{r+1}{2^{r+1}}\\
&=2-\frac{2^r(r+2)+r+1}{2^{r+1}}\\
&=2-\frac{2^{n-1}(n+1)+n}{2^n}
\end{align}$$
How does $2^{n-1}(n+1)\equiv2$? Or is my method wrong? I've probably made a stupid mistake!
 [/INST] Note that 
$$-\frac{r+2}{2^r}+\frac{r+1}{2^{r+1}}=\frac{-2(r+2)}{2^{r+1}}+\frac{r+1}{2^{r+1}}=-\frac{r+3}{2^{r+1}}=-\frac{(r+1)+2}{2^{r+1}}.$$
</s>