# Where am I wrong - Inclusion - Exclusion

Thanks for looking at the question.. I have tried to solve the problem but I'm missing something..

Problem:

How many solutions does the equation Xl + X2 + X3 = 13
have where X l , X2 , and X3 are nonnegative integers less
than 6?

• I have considered that there are C(15,13)=105 possible solutions without considering that X1,2,3 <= 6 .. ( .... | .... | ..*.. )
• Other thing was to find how many solutions are there with x1, x2, or x3 >= 6 that would be, if I'm not wrong C(9,7) = 36 for one of them so for all 3 would be 3*36.. (******..| ... | ...)
• Third and last I'm considering the pairs where both have atleast value >= 6.. C(3,1) = 6 .. (******.. | ****** .. | ..*..) Where are possible 3 pairs to occur .. 3 * 6
• There can't be 3 with value >= 6 So at the end I substracted ..

105 - (3*36 - 3*6) = 105 - 90 = 15

P.s solution says 6 so I'm probably wrong.. Thanks !!

• Your solution first step x is less than 6 not equal to. – Kanwaljit Singh May 6 '17 at 18:40
• @Kanwaljit Singh First step is all the possible answers allowing all values – Math Newbie May 6 '17 at 18:47
• The six are $4+4+5$ or $3+5+5$ or permutations of these – Henry May 6 '17 at 18:49
• @Henry Yeah it's but I can't find where I am wrong with this Inclusion-Exclusion method – Math Newbie May 6 '17 at 19:00

An easier way to solve: if $0 \leq x_1,x_2,x_3 < 6$, then $0< (6-x_1),(6-x_2),(6-x_3) \leq 6$. Also $$(6-x_1)+(6-x_2)+(6-x_3) = 18-(x_1+x_2+x_3)=18-13=5.$$ Let $y_i=7-x_i$. Then we wish to know how many positive solutions there are to $y_1+y_2+y_3=5$. (Note: we do not have to worry about the requirement that $y_i \leq 6$, because if any of them is greater than $6$, their sum cannot be $5$.)
This is just the number of ways of placing $2$ bars in between $5$ stars so that every bar has at least one star on either side of it, e.g., $**|**|*$, which is ${4 \choose 2} = 6$ (choose the two spaces where the bars go from the four spaces between the stars).