• Support PF! Buy your school textbooks, materials and every day products Here!

Is there a better way to find the number of integer solutions

  • #1
321
20

Homework Statement


# of integer solutions of x1+x2+x3+x4 = 32

where x1,x2,x3>0 and 0<x4≤25

Homework Equations




The Attempt at a Solution


So in the case where x4 = 25 we have

x1+x2+x3= 4

in the case where x4 = 24 we have

x1+x2+x3 = 5

.....

in the case where x4 = 1 we have

x1+x2+x3 = 28


so we can do x1+x2+x3+x4 = 28

which will give us f = 31!/3!28!



now we subtract f - g where g =

x1+x2+x3 < 4

(31!/(3!28!)) - (6!/(3!3!))

= 4475

The answer is correct but I don't know if my method is a good one. Can anyone let me know?
 

Answers and Replies

  • #2
34,038
9,877
That should be by far the easiest approach.
which will give us f = 31!/3!28!
To motivate this a bit (not for you, but for other readers): Imagine 28 written as 28 "1"s with three separators to form four groups: 111|11||11111111111111111111111. Now let x1 be the size of the first group plus one, x2 be the size of the second group plus one and so on. My example corresponds to 32 = 4+3+1+24. There is a one to one relation between the sums and the 1/separator strings. There are (31 choose 3) options for the places of the separators. This is the total number of ways to write 32 as sum of four positive integers. Afterwards the ways with x4>25 are subtracted.
 
  • #3
verty
Homework Helper
2,164
198
OP, your post doesn't make sense. First it is 32, then it is 28. Which is it? Also I get a different answer: 4460 (no, it is 4475, I thought x4 < 25). You'll need to be much more clear before I give any further information about my method.
 
  • #4
Charles Link
Homework Helper
Insights Author
Gold Member
4,522
1,926
The OP apparently is doing the case of 28, but I think he is also doing ## x_4<25 ##. If it is ## x_4 \leq 25 ##, the second term should be ## \frac{5!}{2! \, 3!} ## because the term that would be subtracted is the number of ways that ## x_1+x_2+x_3 ## can be 2 or less.
 
  • #5
34,038
9,877
Let's check the excluded cases individually:
x4=26 gives x1+x2+x3=6 which has just the options 1+1+4, 1+2+3, 2+2+2 and permutations of it (total: 3+6+1=10).
x4=27 gives x1+x2+x3=5 which has just the options 1+1+3, 1+2+2 and permutations of it (total: 3+3=6).
x4=28 gives x1+x2+x3=4 which has just the option 1+1+2 and permutations of it (total: 3).
x4=29 gives x1+x2+x3=3 which has just the option 1+1+1 (total: 1).

-> we have to subtract 20. Or (6 choose 3) as can be derived in the same way as the (31 choose 3). This time we are interested in the number of ways x1+x2+x3 ≤ 6, or x1+x2+x3+y ≤ 7 with a positive y to get the same situation as before. The answer in post 1 is correct.
 
  • #6
Charles Link
Homework Helper
Insights Author
Gold Member
4,522
1,926
My mistake. I was working it with ## x1,x2,x3,x4 \geq 0 ##, (instead of ## >0 ##). ## \\ ## Additional comment: In his solution in the original post, I think the OP changed what ## x1,x2, ## and ## x3 ## represent. He is letting them be additional amounts that get added to the group which are already assumed to have one unit in them. The OP has a very good solution, but I don't think he presented his solution as clearly as he could have.
 
Last edited:

Related Threads for: Is there a better way to find the number of integer solutions

Replies
2
Views
2K
Replies
3
Views
5K
Replies
30
Views
2K
Replies
5
Views
554
Replies
25
Views
3K
Replies
5
Views
1K
Replies
4
Views
1K
Top