Question: How to calculate this summation $S=\sum_{k=0}^m a^k b^{m-k} {n_1\choose k} {n_2\choose m-k} $? Where $m<n_1,m<n_2$

Remark1: When $a=b$, I know the above summation $S=a^m\sum_{k=0}^m {n_1\choose k} {n_2\choose m-k} =a^m {n_1+n_2\choose m} $.

Remark2: This summation looks somewhat similar to the usual binomial formula $\sum_{k=0}^m a^k b^{m-k} {m\choose k} =(a+b)^m$. So is there also a similar formula for $S$?

  • 4
    $\begingroup$ It is the coefficient of $x^m$ in $(1+ax)^{n_1}(1+bx)^{n_2}$. In general there is no closed form expression without using special functions. $\endgroup$ Sep 29 at 19:32
  • $\begingroup$ @Fedor Petrov Thank you! $\endgroup$
    – Dian
    Sep 29 at 20:01

1 Answer 1


In terms of a hypergeometric function you would have $$S=\sum_{k=0}^m a^k b^{m-k} {n_1\choose k} {n_2\choose m-k}=b^m \binom{n_2}{m} \, _2F_1\left(-m,-n_1;-m+n_2+1;a/b\right).$$ I don't see a simpler closed-form expression for arbitrary parameters, but if you fix $n_1$ this does simplify to a simple rational function of $m,n_2,a/b$.


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.