How many solutions to x+y+z=15

  • Thread starter Thread starter MinusTheBear
  • Start date Start date
MinusTheBear
Messages
22
Reaction score
0

Homework Statement


How many nonnegative integer solutions does the following equation has x + y + z = 15 if x ≥ 3, y ≥ 2, and 1 ≤ z ≤ 3?

Homework Equations

The Attempt at a Solution



Part A:
Since x ≥ 3, y ≥ 2
let a = x - 3 and b = y - 2
a + b + z = 15 - 3 - 2
a + b + z = 10

Therefore,
n = 10
r = 3
via r-combination with repetition formula there are C(10 + 3 - 1, 10) ways to complete part A. That is C(12,10) = 66 ways.

Part B:

From part A we have
a + b + z = 10
Since 1 ≤ z ≤ 3 subtracting 1 from both sides we get 0 ≤ z ≤ 2 that is z ≤ 2, we must also subtract 1 from the equation
a + b + z = 10 - 1 = 9

Since z is at most 2, we can use z compliment and subtract it from part a.
The complement of z is z ≥ 3, let c = z - 3
a + b + c = 9 - 3
a + b + c = 6

Therefore,
n = 6
r = 3

via r-combination with repetition formula there are C(6+3-1, 6) ways to complete part B. That is C(8,6) = 28 ways.

Since we took the compliment in Part B, we must subtract it from Part A. So,
66 - 28 = 38.

MY ANSWER: 38
SOLUTION: 27.
 
Last edited:
Physics news on Phys.org
MinusTheBear said:

Homework Statement


How many nonnegative integer solutions does the following equation has x + y + z = 15 if x ≥ 3, y ≥ 2, and 1 ≤ z ≤ 3?

Note: I realize I should be using different variables, but for readability I figured it'd be easier to post it like I did. Also, I solved a problem identical to this with different restraints using the same method below and got the correct answer. I think the solution may be wrong, but I'd like my work to be checked.

Homework Equations

The Attempt at a Solution



Part A:[/B]
Since x ≥ 3, y ≥ 2
x + y + z = 15 - 3 - 2 = 10
via combination formula there are C(10 + 3 - 1, 10) ways to complete part A. That is C(12,10) = 66 ways.

Part B:

From part A we have
x + y + z = 10
Since 1 ≤ z ≤ 3 or 0 ≤ z ≤ 2 that is z ≤ 2, we have
x + y + z = 10 - 1 = 9

The complement of z is z ≥ 3, we have
x + y + z = 9 - 3 = 6
via combination formula there are C(6+3-1, 6) ways to complete part B. That is C(8,6) = 28 ways.

Since we took the compliment we have Part A - Part B = Answer. So, 66 - 28 = 38.

SOLUTION: 27.

Your answer of 27 is correct, but your writeup is horrible. You say "for readability it'd be easier to post it like I did". In fact, the very opposite is true: for readability, you absolutely MUST use different variable names, so x = x' + 3, y = y' + 2, z = z'+1, with x', y', z' >=0 and z' <=2. Now x'+y'+z'= 15-6 = 9.

After that, I do not understand what you are doing, using combinations and such, and that is not the way I would choose to attack the problem.
 
  • Like
Likes PeroK and MinusTheBear
Ray Vickson said:
Your answer of 27 is correct, but your writeup is horrible. You say "for readability it'd be easier to post it like I did". In fact, the very opposite is true: for readability, you absolutely MUST use different variable names, so x = x' + 3, y = y' + 2, z = z'+1, with x', y', z' >=0 and z' <=2. Now x'+y'+z'= 15-6 = 9.

After that, I do not understand what you are doing, using combinations and such, and that is not the way I would choose to attack the problem.
I got 38, not 27. The solution was 27. I modified the original post. Hopefully it makes more sense.

Also: I wrote this out by brute force, so I know the answer is indeed 27. But, I'm not sure where I messed up in my work.
 
Last edited:
Can you take a look at this recent post?

https://www.physicsforums.com/threa...u-roll-an-18-from-5-dice.939444/#post-5939456

- - - -
try writing your problem out in terms of multiplying 3 appropriate polynomials, and matching coefficients with the desired exponent, as in that problem. Start with a naive, direct implementation, then try to streamline it a bit and make it easier/faster to solve.

Learning to become 'friends' with polynomials will pay huge dividends -- they are one of the most studied structures out there (maybe the most?) and there's tons of interesting things you can do with them mathematically and computationally.
 
Last edited:
MinusTheBear said:
I got 38, not 27. The solution was 27. I modified the original post. Hopefully it makes more sense.

Also: I wrote this out by brute force, so I know the answer is indeed 27. But, I'm not sure where I messed up in my work.

A straightforward approach (some enumeration, but not actually "brute force") is to note that you want to solve for non-neg. integers a,b,c such that a+b+c=9 and 0 <= c <= 2.

Just let c =0, 1and 2, and solve these three problems separately.

Can you see why the number of solutions to a+b=n is n+1?
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top