I'm trying to prove this by mathematical induction, but I just can't seem to get the answer that I should be getting. Here's what I have so far:
Let $P(n)$ be the statement (this is the equation that I'm supposed to prove by induction): $$\sum_{i=0}^n (n-i)2^i = 2^{n+1}-n-2,$$ Basis step: $(n=0)$: $$P(0) = (0-0)2^0 = 2^{0+1}-0-2 = 0 = 0.$$ Inductive step: Assume that $P(n)$ is true, that is, $$\sum_{i=0}^n (n-i)2^i = 2^{n+1}-n-2.$$
Showing that $P(n+1)$ is also true, that is: $$\sum_{i=0}^{n+1} (n-i)2^i = 2^{n+2}-(n+1)-2 $$ $$ = 2^{n+2}-n-3 $$ $P(n+1) ={}$ $$\sum_{i=0}^{n+1} (n-i)2^i + n-(n+1)2^{n+1}$$ $$ = 2^{n+1}-n-2+(n-n-1)2^{n+1} $$ $$ = 2^{n+1}-n-2-(1)2^{n+1}$$
As can be seen, I am not getting back the result I'm supposed to be getting for $P(n+1)$. Can someone assist me here, please?