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?

  • 4
    $\begingroup$ Provide the code of your formula in Mathematica $\endgroup$
    – Artes
    Nov 1 '15 at 1:23
  • $\begingroup$ I just used the online wepage of mathematica, I plugged sum r=0,n binomial (n-r-1, n-r) $\endgroup$ Nov 1 '15 at 6:13
  • 1
    $\begingroup$ 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. $\endgroup$
    – J. M.'s torpor
    Nov 1 '15 at 7:31

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

    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.

  • 1
    $\begingroup$ 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. $\endgroup$
    – Coolwater
    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]

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}]]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.