0

I'm trying to find a analytical way for finding the total amount of unique solutions to equation:

$$\sum\limits_{i=1}^n a_i = A, \text{when } l \leq a \leq u,$$ where $a,A,l,u \in \mathbb{N}$. For example:

$$\sum\limits_{i=1}^2 a_i = 4, \text{when } 1 \leq a \leq 3,$$ has solution three unique solutions $(2,2), (1,3), (3,1)$. I haven't found a strategy for this type of problem in any literature, but it seems to be a type of problem that interest mathematicians.

Allstar
  • 41
  • 2
    The number of solutions to this equation is the coeffecient of $x^A$ in the following expansion: $(x^l+{x}^{l+1}+\dots + x^u)^n$ – Oussama Boussif Jul 14 '16 at 11:10
  • Thanks! @OussamaBoussif. Does this method have a name (wikipedia entry?). Is it a well know result? – Allstar Jul 14 '16 at 11:14
  • 1
    @Allstar This method (generating functions) is commonly taught in undergraduate combinatorics classes. Another way to phrase this problem: Find the number of $A$-combinations of a multiset with $n$ types of objects, each with repetition number $u$, such that each type of object is selected at least $\ell$ times. – D Poole Jul 14 '16 at 15:23

1 Answers1

3

First let $b_i=a_i-\ell$ for $i=1,\ldots,n$; the number of integer solutions to

$$\sum_{i=1}^na_i=A$$

satisfying $\ell\le a_i\le u$ for $i=1,\ldots,n$ is the same as the number of integer solutions to

$$\sum_{i=1}^nb_i=A-\ell n$$

satisfying $0\le b_i\le u-\ell$ for $i=1,\ldots n$. The accepted answers to this question and this question give the answer, albeit without going into much detail:

$$\sum_{k=0}^n(-1)^k\binom{n}k\binom{A-\ell n+n-1-k(u-\ell+1)}{n-1}\;,$$

where the upper number in the last binomial coefficient can be simplified in various ways. To the best of my knowledge there is no nice closed form for this.

The problem can also be solved using generating functions, but evaluating the desired coefficient is typically as messy as computing the sum above.

Brian M. Scott
  • 616,228