# Sums of binomial expressions returns different and sometimes indeterminate expressions

A problem that I encountered multiple times when taking sums over expressions involving binomials, factorials, etc. is that Mathematica (version 11.2) returns indeterminate expressions when it should not.

An example:

If an urn contains n balls out of which q balls are red and n-q balls are blue. There are Binomial[q, z]*Binomial[n - q, k - z] possibilities for drawing k balls out of the urn so that z drawn balls are red and k-z drawn balls are blue. Summing over all possible values of z, one should obtain the total number of possibilities to draw k balls from the urn (regardless their colour). This number is Binomial[n,k].

Let's get Mathematica to compute this.

Sum[Binomial[q, z]*Binomial[n - q, k - z], {z, 0, k}]


This returns

((-1)^(2 + k) (-1 + k - n)!)/(k! (-1 - n)!)


This expression is indeterminate because (-1 + k - n)! and (-1 - n)! evaluate to ComplexInfinity.

I can get Mathematica to produce the correct result by substituting n->k0+k:

Sum[Binomial[q, z]*Binomial[k0 + k - q, k - z], {z, 0, k}]


This returns

(k + k0)!/(k! k0!)


which simplifies to Binomial[n,k] if I reverse the substitution.

It seems unsatisfying to me that Mathematica's result depend so sensitively on the way I define my variables. Why is that so and what can I do to ensure that I always define my variables in a way that Mathematica produces the correct results?

I have tried using assumptions but with no success. The lines

Assuming[n > k, Sum[Binomial[q, z]*Binomial[n - q, k - z], {z, 0, k}]]
Assuming[k0 > 0, Sum[Binomial[q, z]*Binomial[k0 + k - q, k - z], {z, 0, k}]]


produce the same results as if I wouldn't use Assuming.

s2 = Sum[Binomial[q, z]*Binomial[n - q, k - z], {z, 0, k},

FullSimplify[s2 == Binomial[n, k], Assumptions -> {n, k} \[Element] Integers && k <= n]