1

How many ways can a+b+c+d=18, where a,b,c,d are integers such that $|a|,\ |b|,\ |c|,\ |d|$ are each at most 10?

This is what I have so far. If all four numbers have the restriction -10 =< a, b, c, d, =< 10, than we can add 11 to each number, where

w = a+11, x = b+11, y = c+11, z = d+11

w+x+y+z = 29. Would it be $C(28,3)$ or did I overcount some numbers?

  • Why is $w + x + y + z = 29$? – Arthur Dec 17 '14 at 19:46
  • @Arthur Oh I see. I should add 44, not 11 to 18 on the RHS. w+x+y+z = 62? – Math is Life Dec 17 '14 at 19:47
  • Yes. I'm still trying to understand the second part. – Arthur Dec 17 '14 at 19:47
  • @Arthur Are you referring to the $C(28,3)$, (though that would be $C(61,3)$ now) part? That is just regular distribution – Math is Life Dec 17 '14 at 19:48
  • So you are looking for $1 \leq w,x,y,z \leq 21$ such that $w+x+y+z = 62$. Why are there $28 \choose 3$ (or $61 \choose 3$ I guess) ways for that? – Arthur Dec 17 '14 at 19:50
  • @Arthur Hmm. I forgot about the restriction for w, x, y, z. That would change the combinatorial. – Math is Life Dec 17 '14 at 19:51
  • Well you can simply count down the options ($2284$) and see if it matches your formula. – barak manos Dec 17 '14 at 19:54
  • @Arthur So if w = 21-d, x = 21-e, y = 21-f, and z = 21-g, than w+x+y+z = 84-(d+e+f+g) = 84-62 = 22. Would the # of solutions then be $C(21, 3)$? – Math is Life Dec 17 '14 at 19:55
  • @barakmanos that would be a lot of counting.. – Math is Life Dec 17 '14 at 19:59
  • @MathisLife: Python interpreter didn't seem to mind that when I asked him (or her) to do it. – barak manos Dec 17 '14 at 20:00
  • @barakmanos I don't have a problem with it...but shouldn't individually counting each case be a last resort, as it takes a lot of calculations? – Math is Life Dec 17 '14 at 20:51
  • @MathisLife his point was that if you are handy with programming for and while loops in java/python/c/etc... then you can always write a program to brute force an answer (which seems to be how barak got to the [correct] answer of 2284). While not elegant, it can sometimes be more feasible than coming up with an analytical approach to certain problems. – JMoravitz Dec 17 '14 at 22:02
  • @JMoravitz: My point was - OP already has what he/she thinks is the correct analytic solution, and is now asking us to verify it. So I just meant to say that there was an easier method for verification. – barak manos Dec 18 '14 at 07:00

1 Answers1

1

This is a balls and urns problem solvable using a combination of inclusion-exclusion and stars&bars

$|a|\leq 10 \Rightarrow -10\leq a \leq 10$. Make a change of variable $x_1 = a+10\Rightarrow 0\leq x_1 \leq 20$

Do similarly to the other letters, so we are at $x_1 + x_2 + x_3 + x_4 = (a+10) + (b+10) + (c+10) + (d+10) = (a+b+c+d)+40 = 18+40 = 58$

Number of ways in which no upper bound conditions are violated = number of ways without upper bound condition - number of ways at least one condition is violated + number of ways two conditions are violated - number of ways 3 conditions are violated + number of ways 4 conditions are violated.

To violate one upper bound condition (say for example $x_1$) then $x_1>20\Rightarrow x_1\geq 21$ make a change of variable $y_1 = x_1 - 21$. Then $0\leq y_1$ and $y_1+x_2+x_3+x_4 = 37$. As there were 4 choices for which was the offending $x$, we multiply by 4.

Do similarly for the case of two violating terms. Note for 3 or 4 violating terms, it is impossible.

$ = \binom{58+4-1}{4-1} - 4\cdot \binom{37+4-1}{4-1} + 6\cdot\binom{16+4-1}{4-1} - 0 + 0 = 2284$


It should be mentioned in case you haven't seen stars&bars, to find the number of integer solutions of $x_1 + x_2 + \dots + x_r = n$ where each $x_i\geq 0$, there are $\binom{n+r-1}{r-1}$ number of solutions.

JMoravitz
  • 79,518