# Find the number of possible solutions in $x+y+z=30$ under conditions.

Three variables $x,y,z$ have a sum of $30$. All three are Non-Negative integers. If any $2$ variables don't have the same value and exactly one variable has value less than or equal to $3$, find the number of possible solutions ?

$a.)\ 98 \\ b.)\ 285 \\ c.)\ 68 \\ \color{green}{d.)\ 294\\}$

I did

$x=0,y+z=30\implies 31\ \text{ways}$

$x=1,y+z=29\implies 30\ \text{ways}$

$x=2,y+z=28\implies 29\ \text{ways}$

$x=3,y+z=27\implies 28\ \text{ways}$

Total ways=$118$

But the book is giving answer as $294$ .

I look for a short and simple way.

I have studied maths upto $12$th grade.

Your method is OK, just a few slips - however unless I'm missing something, none of the suggested answers is correct.

• $x=0$, $y+z=30$: only $23$ ways with $y,z\ge4$, but one of these is $y=z=15$ which is not allowed, so only $22$ ways.
• Similar adjustments give $22+22+20+20=84$.
• But any of the three variables could be ${}\le3$, it doesn't have to be $x$. So multiply by $3$ to give (answer) $252$ possibilities.

For one thing, you made $x$ specifically be the one that is 3 or less.

For another, your counts of solutions to things like $y+z=30$ are too high. When you say $31$, you are counting $15+15$, $0+30$, $1+29$, etc all of which are not allowed.

• If $x=0$, then $y+z=30$ has 22 solutions within the rules.
• If $x=1$, then $y+z=29$ has 22 solutions within the rules.
• If $x=2$, then $y+z=28$ has 20 solutions within the rules.
• If $x=3$, then $y+z=27$ has 20 solutions within the rules.

At this point that makes $84$. Now multiply by $3$ in case $y$ or $z$ is the one that is 3 or less. So I get $252$, not among the choices.

X+Y+Z=30 ; given any one of the number ranges from 0-3 and all other numbers start from 4. Hence consider the following equations:

1. X=0 ; Y+Z=30 The solution of the above equation is obtained from (n-1)C(r-1) formula. Total solutions obtained = 29 of which (y,z): (2,27)(27,2)(2,28)(28,2)(1,29)(29,1) must not be counted since they contain 1,2,3 as a part of solution. So, total number of ways= 29-6= 23 ways.

2. X=1; Y+Z=29 Total solutions obtained = 28 of which (y,z): (2,27)(27,2)(1,28)(28,1)(3,26)(26,3) must not be counted since they contain 1,2,3 as a part of solution. So, total number of ways= 28-6= 22ways.

3. X=2 ; Y+Z=28 Total solutions obtained = 27 of which (y,z): (1,27)(27,1)(2,26)(26,2)(3,25)(25,3) must not be counted since they contain 1,2,3 as a part of solution. So, total number of ways= 27-6= 21ways.

4. X=3 ; Y+Z= 27 Total solutions obtained = 26 of which (y,z): (1,26)(26,1)(2,25)(25,2)(3,24)(24,3) must not be counted since they contain 1,2,3 as a part of solution. So, total number of ways= 26-6= 20 ways.

Total number of ways = 23+22+21+20 = 84 ways

Total number of ways considering X,Y and Z = 84*3 = 252.

We shall first count in ascending order for x,y,z

start | range | ways using Gauss method

0 .... 4-26 ... $\lfloor\frac{23}{2}\rfloor = 11$

1 .... 4-25 ... $\lfloor\frac{22}{2}\rfloor = 11$

2 .... 4-24 ... $\lfloor\frac{21}{2}\rfloor = 10$

3 .... 4-23 ... $\lfloor\frac{20}{2}\rfloor = 10$

total = 42

ans = $42\cdot3! = 252$