# Thread: Integer Soultion to an equation...

1. ## Integer Soultion to an equation...

How many integer solutions (x1; x2; x3) are there to the equation :-

x1 + x2 + x3 = 25

with all xi satisfying 0 < xi < 10?

2. Originally Posted by aamiri
How many integer solutions (x1; x2; x3) are there to the equation :-

x1 + x2 + x3 = 25

with all xi satisfying 0 < xi < 10?
Maybe not the most elegant, but:

The lowest possible for x1 is 5, forcing (x2,x3)=(10,10).

Fix x1=6 then it's either (x2,x3)=(9,10) or (10,9)

Fix x2=7 then it's either (x2,x3)=(8,10) or (10,8) or (9,9)

As you can see there really aren't that many options if you continue in this manner.

3. ^^ Thanks for taking out time to reply.

So, in this case , do I just keep going in the same manner as you did?

Is there any other way of doing this ?

4. Originally Posted by aamiri
^^ Thanks for taking out time to reply.

So, in this case , do I just keep going in the same manner as you did?

Is there any other way of doing this ?
Well for these numbers I think it's fine to continue in the same manner, it's quick enough. For an extended problem like

x1 + x2 + ... + x7 = 39

one approach if you are allowed a computer is to solve recursively. For other ways to solve, maybe someone else will chime in.

5. Originally Posted by aamiri
How many integer solutions (x1; x2; x3) are there to the equation :-

x1 + x2 + x3 = 25

with all xi satisfying 0 < xi < 10?
A generating function solution requires the least thought, in my opinion.

Suppose, more generally, we want to count the integer solutions to
$x_1 + x_2 + x_3 = r$
where $0 \leq x_i \leq 10$;
let's say the number of solutions is $a_r$.
Then $a_r$ is the coefficient of $x^r$ in
$f(x) = (1 + x + x^2 + \dots + x^{10})^3$.

From here on it's just a matter of manipulating series:
$f(x) = \left( \frac{1-x^{11}}{1-x} \right) ^3$
$= (1- x^{11})^3 (1-x)^{-3}$
$= (1 - 3 x^{11} + 3 x^{22} - x^{33}) \sum_{i=0}^{\infty} \binom{3+i-1}{i} x^i$

Picking out the coefficient of $x^{25}$ from this expression, we can see it is

$a_{25} = \binom{27}{25} - 3 \binom{16}{14} + 3 \binom{5}{3}$.

I think a solution via inclusion/exclusion is also possible (I haven't worked it out), but I think it will lead to the same expression for the answer. Only you will have to think harder. :-P