Consider the equation:
a + b + c + 4 d = 2 0 .
How many non-negative integer solutions are there of this equation?
Details and Assumptions:
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
There is an especially useful function in Mathematica for this kind of problem: (FrobeniusSolve[{a, b, c}, s] for finding the list of all solutions to the equation a x + b y + c z = = s , where a , b , c are given positive integers and d is an integer, while x , y , z are non-negative integers to be found.
The formula is FrobeniusSolve[{1, 1, 1, 4}, 20] // Length
Here's a python script to achieve the same:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Hey I used a python script as well!
1 2 3 4 5 6 7 8 9 |
|
The equation we have is 2 0 = a + b + c + 4 d . Now,because there is a 4 d in that equation it makes our job easier as now we know the range of d which is from 0 to 5 . C a s e 1 : d = 0 ⟹ a + b + c = 2 0 .Let us first consider the non-zero cases.We have a theorem for that which is ( k − 1 n − 1 ) where n = 2 0 ( a + b + c ) and k = 3 ( a , b , c ) the proof of this is very simple if one uses stars and bars.Now,let us consider the cases which have one or two or all of a , b , c = 0 . C a s e 1 : a = 0 , b = 1 , 2 . . . 1 0 , c = 1 9 , 1 8 . . . 1 0 . Now,it is easy to do the permutations. C a s e 2 : a = b = 0 , c = 2 0 . This gives a total of ( 2 1 9 ) (non-zero cases+ 6 0 (zero cases). C a s e 2 : d = 1 ⟹ a + b + c = 1 6 . Again,let us first consider the non-zero cases = ( 3 − 1 1 6 − 1 ) , Now let us consider the zero cases a = 0 , b = 1 , 2 , 3 . . . . 7 , c = 1 5 , 1 4 , 1 3 . . 8 . We can easily do the permutations giving us 4 0 cases.So,total= ( 2 1 5 ) + 4 8 . We do the same thing with d = 3 and see that their is a pattern ( 2 1 9 ) + 6 0 , ( 2 1 5 ) + 4 8 , ( 2 1 1 ) + 3 6 . . . Last case is d = 5 which has only one solution = ( a , b , c , d ) = ( 0 , 0 , 0 , 2 0 ) .
Problem Loading...
Note Loading...
Set Loading...
The problem can be solved with stars=and-bars method with a twice, as d has a 4 as coefficient.
There are 6 acceptable values for d = 0 , 1 , 2 , 3 , 4 , 5 .
When d = 0 , then we need to find the number of solutions for a + b + c = 2 0 . This is equivalent to finding the number of solutions for x + y + z = 2 3 using the stars-and-bars method, which requires x , y , z ≥ 1 , while a , b , c can be 0 . The number of solutions is given by: N 0 = ( 2 3 − 1 3 − 1 ) = ( 2 2 2 ) . The number of solutions when d = n , n = 0 , 1 , 2 , 3 , 4 , 5 is therefore, N n = ( 2 2 − 4 n 2 ) . Therefore, the total number of solutions:
N = N 0 + N 1 + N 2 + N 3 + N 4 + N 5
= ( 2 2 2 ) + ( 1 8 2 ) + ( 1 4 2 ) + ( 1 0 2 ) + ( 6 2 ) + ( 2 2 )
= 2 3 1 + 1 5 3 + 9 1 + 4 5 + 1 5 + 1 = 5 3 6