5
$\begingroup$

I would like to calculate the number of integral solutions to the equation

$$x_1 + x_2 + \cdots + x_n = k$$

where

$$a_1 \le x_1 \le b_1, a_2 \le x_2 \le b_2, a_3 \le x_3 \le b_3$$

and so on.

How do we approach problems with variables constrained on both sides $(a_1 \le x_1 \le b_1)$ or with constraints like $x_1 \le b_1$?

I know that the same equation with constraints like $x_1 \ge a_1, x_2 \ge a_2$ and so on can be solved using a slight modification of the formula $\binom{n + k - 1}{ k}$. Is it possible to tweak the same formula to suit the given problem?

  • 2
    possible duplicate of [No. of possible solutions of given equation](http://math.stackexchange.com/questions/68993/no-of-possible-solutions-of-given-equation)2011-10-01
  • 0
    @Jyrki: this was asked at 10:46:52 and [the other](http://math.stackexchange.com/questions/68993/no-of-possible-solutions-of-given-equation) was asked at 12:00:10, so I voted to close that one.2011-10-01
  • 0
    @robjohn: Ok, but for some reason I saw the other one first. Is the time stamp of the migration available somewhere?2011-10-01
  • 0
    @Jyrki: hover over the time in the "migrated from..." It says 12:07:20. So it was migrated after the other was asked here (by 7 minutes). So the "time asked" here is the pre-migration time asked.2011-10-01

2 Answers 2