# Wrong output from Mathematica when evaluating a summation

Consider the sum

$$\sum_{r=0}^n \binom{n-r-1}{n-r}$$

This sum is not zero because when $r=n$, the result is $\binom{-1}{0} = 1$. However, plugging this formula into Wolfram Alpha does return zero. Why is this?

• Provide the code of your formula in Mathematica Nov 1 '15 at 1:23
• I just used the online wepage of mathematica, I plugged sum r=0,n binomial (n-r-1, n-r) Nov 1 '15 at 6:13
• Wolfram Alpha is a very different beast from Mathematica. From your original question, you used the former, but called it the latter, so I corrected it. But once more: the two things are very different. Nov 1 '15 at 7:31

Mathematica has no problem with specific values of n until n == 10^6

Table[{n,
Sum[
Binomial[n - r - 1, n - r],
{r, 0, n}]},
{n, 999998, 10^6}] // Grid


As stated in the documentation for Sum, "If the range of a sum is finite, i is typically assigned a sequence of values, with f being evaluated for each one." The problem apparently occurs with the switch from enumerating the sum to symbolically evaluating the sum.

• However, this doesn't explain why Mathematica fails for a symbolic n. In the symbolic case, it is actually not sum that fails, because the problem is due to fact that Binomial[n - r - 1, n - r] evaluates to 0. Nov 1 '15 at 11:41

As noted, this is due to the fact that the indefinite sum is $0$:

Sum[Binomial[n - r - 1, n - r], r]
0


One simple cure is to split off the "peculiar" term,

Sum[Binomial[n - r - 1, n - r], {r, 0, n - 1}] + Binomial[n - n - 1, n - n]


but an even better route is to flip the binomial coefficient:

Assuming[n ∈ Integers,
Simplify[Sum[(-1)^(n - r) Binomial[0, n - r], {r, 0, n}]]]