Using summation by parts to evaluate an alternating sum I want to evaluate
$$
 \sum_{k=0}^n (-1)^k \binom{n}{k} k.
$$
I tried summation by parts, i.e. the formula
$$
 \sum_{k=0}^n (f(k+1) - f(k))g(k)
  = f(n+1)g(n+1) - f(0)g(0) - \sum_{k=0}^n f(k+1) (g(k+1) - g(k))
$$
with $f(k+1) - f(k) = (-1)^k \binom{n}{k}$ and $g(k) = k$. As
$$
 (-1)^{k+1}\binom{n-1}{k+1} - (-1)^k \binom{n-1}{k}
 = (-1)^{k+1} \left( \binom{n-1}{k+1} + \binom{n-1}{k} \right)
 = (-1)^{k+1} \binom{n}{k+1} 
$$
we have $f(k) = (-1)^k \binom{n-1}{k}$. Plugging into the formula
\begin{align*}
 \sum_{k=0}^n (-1)^k \binom{n}{k} k
  & = (-1)^{n+1} \binom{n-1}{n+1} (n+1) - (-1)^0 \binom{n-1}{0}\cdot 0
    - \sum_{k=0}^n (-1)^{k+1} \binom{n-1}{k+1} \\
  & = \sum_{k=0}^n (-1)^{k} \binom{n-1}{k+1}.
\end{align*}
But for example if $n = 3$ then
$$
 \sum_{k=0}^n (-1)^k \binom{n}{k} k = -3 + 6 -3 = 0
$$
but
$$
 \sum_{k=0}^n (-1)^{k} \binom{n-1}{k+1} 
  = \binom{2}{1} - \binom{2}{2}
  = 1
$$
which is not equal, but I cannot see whats wrong with the above derivation??

You need $f(k+1) - f(k) = (-1)^k \binom{n}{k}$. But
$$
 (-1)^{k+1}\binom{n-1}{k+1} - (-1)^k \binom{n-1}{k}
 = (-1)^{k+1} \left( \binom{n-1}{k+1} + \binom{n-1}{k} \right)
 = (-1)^{k+1} \binom{n}{k+1} 
$$
So 
$$
 (-1)^{k}\binom{n-1}{k} - (-1)^{k-1} \binom{n-1}{k-1}
 = (-1)^{k} \left( \binom{n-1}{k} + \binom{n-1}{k-1} \right)
 = (-1)^{k} \binom{n}{k} 
$$
$f(k)=(-1)^{k-1} \binom{n-1}{k-1}$.
Of course, When $k=0$ and $k=n+1$, we have special cases and should consider seperately.
$f(1)=\binom{n-1}{0}=1$
$f(1)-f(0)=(-1)^0\binom{n}{0}=1$ and so $f(0)=0$
$f(n)=(-1)^{n-1}\binom{n-1}{n-1}=(-1)^{n-1}$
$f(n+1)-f(n)=(-1)^n\binom{n}{n}=(-1)^n$ and so $f(n+1)=(-1)^n+(-1)^{n-1}=0$
\begin{align*}
 \sum_{k=0}^n (-1)^k \binom{n}{k} k
  & =(0) (n+1) -(0)(0)
    - \sum_{k=1}^{n-1} (-1)^{k} \binom{n-1}{k}-f(1)(g(1)-g(0))-f(n+1)(g(n+1)-g(n)) \\
  & = - \sum_{k=0}^{n-1} (-1)^{k} \binom{n-1}{k}+(-1)^0\binom{n-1}{0}-1\\
&=0
\end{align*}

My work:
$\displaystyle (1+x)^n=\sum_{k=1}^n\binom{n}{k}x^k+1$
Differentiating,
$\displaystyle n(1+x)^{n-1}=\sum_{k=1}^nk\binom{n}{k}x^{k-1}$
Put $x=-1$.
\begin{align*}
\sum_{k=1}^nk\binom{n}{k}(-1)^{k-1}&=0\\
\sum_{k=1}^nk\binom{n}{k}(-1)^{k}&=(-1)(0)\\
\sum_{k=0}^nk\binom{n}{k}(-1)^{k}&=0+0=0\\
\end{align*}
