# What does Mathematica do with binomial coefficients when their arguments are negative?

I have to sum the following:

f[L_, M_, w_] = Sum[(-1)^(i + 1) Binomial[M, i] Binomial[L + M - 1 - i w, M - 1], {i,1, M}]


However, for some of the terms, the first argument in second binomial coefficients becomes negative. I would like to know two things:

1. How can I define these terms to be zero?
2. What does Mathematica actually do when this happens?

To clarify, if L=M=w=3 I would like the output to be 3, and not 10 (which is $\binom{L+M-1}{L}$ btw).

• After first glance: don't use N - it's a built-in symbol. – corey979 Sep 7 '16 at 17:40
• @corey979 I was confused there for a sec, but I don't think it caused any trouble in this instance. But yeah, I shouldn't use it. – Bobson Dugnutt Sep 7 '16 at 17:49

You can define your own binomial that behaves like you want:

binomial[a_, b_] := Piecewise[{{Binomial[a, b], a >= 0 && b >= 0}, {0, a < 0 || b < 0}}]


Then

f[L_, M_, w_] := Sum[(-1)^(i + 1) binomial[M, i] binomial[L + M - 1 - i w, M - 1], {i, 1, M}]
f[3,3,3]


3

To answer your second question, here's what the documentation says about binomial coefficients for arbitrary real values:

In general, ${ n \choose m}$ is defined by $\Gamma(n+1)/(\Gamma(m+1) \Gamma (n-m+1))$ or suitable limits of this.

(If you're not familiar with the gamma function, you can view it as a generalization of the factorial to the real numbers, with $\Gamma(n + 1) = n!$ for $n \in \mathbb{N}^+$.) We can use FunctionExpand to find the precise definitions in terms of the gamma functions:

FunctionExpand[Binomial[-n, m], Assumptions -> {n ∈ Integers, n > 0, m ∈ Integers, m >= 0}]

(* ((-1)^m Gamma[m + n])/(Gamma[1 + m] Gamma[n]) *)

FunctionExpand[Binomial[-n, -m], Assumptions -> {n ∈ Integers, n > 0, m ∈ Integers,  n > m > 0}]

(* 0 *)

FunctionExpand[Binomial[-n, -m], Assumptions -> {n ∈ Integers, n > 0, m ∈ Integers, m >= n}]

(* ((-1)^(m - n) Gamma[m])/(Gamma[1 + m - n] Gamma[n]) *)


Or, to summarize: for $n, m \in \mathbb{N}^+$ we have $${-n \choose m } = \frac{ (-1)^m (m + n - 1)!}{m! (n-1)!} = (-1)^m {n + m - 1 \choose m}$$ $${-n \choose -m } = \begin{cases} \frac{(-1)^{m-n} (m-1)!}{(n-1)!(m - n)!} = (-1)^{m-n} {m-1 \choose n-1} & m \geq n \\ 0 & m < n \end{cases}$$