# How many possible solutions for the equation $x_1 +x_2+x_3+x_4=20$

1. If $x_i\ge 0$ where $i \in\{1,2,3,4\}$
2. If $x_1\ge 2$ ,$x_2 \ge 3$, $0 \le x_4 \le 2$

What I tried :

for the first question I subtracted the number of possible solutions of $x_1 + x_2 +x_3 +x_4 < 19$ from the number of possible solutions of $x_1 + x_2 +x_3 +x_4 <= 20$.

For the second I used the replacement: $y_1= x_1 - 2$, $y_2= x_2 -3$, $y_3=x_3$ , $y_4=x_3$ and I am searching for the number of ways to place $15$ balls in $4$ boxes where box $3$ takes up to $15$ balls and box $4$ up to $2$ balls. I don't know if it is correct ...

• For the first I tried : Number of possible solutions of (x1+....+x4<=20 ) minus number of possible solutions of (x1+...+x4<20) where x1,x2,x3,x4 >=0 which equals C(20+4,4) - C(19,4) – Nicole Douglas May 8 '17 at 16:56
• For the second : I used the replacement : y1=x1 -2 , y2=x2-3, y4=x4, y3=x3 and I am looking for ways to put 15 balls in 4 boxes where( y1+...+y4=15) while y4 can take up to two balls and y3 can take up to 15 balls ,but I am not sure if it is correct... – Nicole Douglas May 8 '17 at 17:01
• Put what you have tried into the question statement itself, not into the comments. As for the first, it should already be in a usable form... if the most convenient form for you is for some reason $x_1+\dots+x_4\leq 20$, then note that subtracting the number of solutions to $(x_1+\dots+x_4<20)$ is the same as subtracting the number of solutions to $(x_1+\dots+x_4\leq 19)$, shouldn't be any reason for the two terms you are manipulating to be so far apart from eachother. – JMoravitz May 8 '17 at 17:07
• As for the second problem, making the change of variables you already suggested, this is finding solutions to $y_1+\dots+y_4=15$ where $0\leq y_4\leq 2$. You should be able to solve how many solutions there are had there not been an upper bound on $y_4$. You may then subtract the number of "bad" solutions from that calculation by then removing those solutions for which $3\leq y_4$, finding that amount via a similar change of variable and calculation as before. – JMoravitz May 8 '17 at 17:11
• It is assumed that $0\leq x_3$, otherwise the problem is uninteresting and clearly has infinitely many solutions, treat $x_3$ the same as you do $x_1$ and $x_2$... nothing special needs to be done about it at all. – JMoravitz May 8 '17 at 18:05

Arrange $20$ stars and $3$ bars along a straight lines. For each arrangement, you can read off the values of $x_i$ by counting how many stars are there between the $(i-1)$-th and $i$-th bar. [Using the convention that there is an invisible $0$ bar at the very beginning and also another bar at the very end]
Hence answer is $\binom{23}{3}$.
• No, you cannot add four numbers less than or equal to four and get $20$. – Ross Millikan May 8 '17 at 17:24
• The $i$ refers to the index right? $x_i$ just have nonnegative constraint. – Siong Thye Goh May 8 '17 at 17:26
• Yes the $i$ is the index, but OP always only talks about four summands. – Ross Millikan May 8 '17 at 17:44