SOLUTION: x1 + x2 + x3 + x4 + x5 = 36 How many solutions (using only nonnegative integers) are there to the following equation?

Algebra ->  Permutations -> SOLUTION: x1 + x2 + x3 + x4 + x5 = 36 How many solutions (using only nonnegative integers) are there to the following equation?      Log On


   



Question 1149895: x1 + x2 + x3 + x4 + x5 = 36
How many solutions (using only nonnegative integers) are there to the following equation?

Answer by ikleyn(52777) About Me  (Show Source):
You can put this solution on YOUR website!
.

            This problem and the method of its solution are of the highest peaks in  Combinatorics.
            They are at the level of a School Math circle at the local or  (better to say)  a renowned  University.


x1 + x2 + x3 + x4 + x5 = 36     (1)


Imagine 36 marbles on the table, placed in one straight line with small gaps between them.


Imagine you have 6 numbered bars, of which you place the first bar (bar N1) before the first marble and the last bar (bar N6) 
after the last marble in the row.


Let  x%5B1%5D, x%5B2%5D,  x%5B3%5D, x%5B4%5D, x%5B5%5D be some solution to the given equation.


You then place bar N2 after x%5B1%5D-th marble in the gap in the row of marbles; 

then you count next x%5B2%5D marbles  in the row of marbles after bar N2 and place bar N3 in the gap there;

then you count next x%5B3%5D marbles  in the row of marbles after bar N3 and place bar N4 in the gap there;

finally, you count next x%5B4%5D marbles  in the row of marbles after bar N4 and place bar N5 in the gap there.


At this moment, all 36 marbles are divided in 5 groups between bars (1-2), (2-3), (3-4), (4,5) and (5,6).


Notice that if some x%5Bk%5D is zero, then the corresponding bars go to common respective gap.


So, having the solution to equation (1) in non-negative positive integer number, you place 4 bars N2, N3, N4 and N5 in 
their corresponding positions in gaps in the row of marbles. 


Vise versa, if you place 4 bars B2, B3, B4 and B5 in gaps in the row of 36 marbles, you divide marbles in 5 groups, 
and the numbers of marbles in each group form the solution to equation (1).


Thus, there is one-to-one correspondence between the set of solutions to equation (1) in non-negative integer numbers, 

from one side, and all different possible placings of 4 bars in 35 gaps in the row between 36 marbles.


Thus we have 35+4 = 39 entities, 35 marbles and 4 bars; 35 marbles are indistiguishable and 4 movable bars 
are indistinguishable, too.


The number of all possible indistinguishable arrangements of 39 items of two types with 35 indistinguishable of one type 

and 4 indistinguishable of the other type is  39%21%2F%2835%21%2A4%21%29 = %2839%2A38%2A37%2A36%29%2F%281%2A2%2A3%2A4%29 = 82251.


Hence,  the number of all possible solutions to equation (1) in non-negative integer numbers is equal to  %2839%2A38%2A37%2A36%29%2F%281%2A2%2A3%2A4%29 = 82251.   

ANSWER.  The number of different solutions to equation (1)  is  82251.

Solved.

------------------

More general problem to find the number of non-negative integer solution to equation

    x%5B1%5D + x%5B2%5D + x%5B3%5D + . . . + x%5Bk%5D = n    

where k <= n, can be solved in the same way and has the answer  %28n-1%2Bk-1%29%21%2F%28%28n-1%29%21%2A%28k-1%29%21%29.


We have then   (n-1)  gaps between  "n"  "marbles"  and  (k-1)  movable dividing bars.


The method I used in the solution is called the  "method of bars and stars".


You can read about it in this Wikipedia article

https://en.wikipedia.org/wiki/Stars_and_bars_%28combinatorics%29