6

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?

mmal
  • 3,508
  • 2
  • 18
  • 38
user2820579
  • 161
  • 2

2 Answers2

5

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

enter image description here

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.

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
  • 1
    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. – Coolwater Nov 01 '15 at 11:41
3

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}]]]
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574