# Combinatorics:No of solutions to an equation

Find the number of solutions to the equation $x_1 + x_2 + x_3 + x_4 + x_5 = 22$, where $x_1, x_2, x_3, x_4$ and $x_5$ are non-negative integers, and $x_1+x_2 \leq 2$. (You may leave the answer as an expression consisting of binomial coefficients.) So I tried solving it and I think we need to consider the cases when $x_1+x_2$ is equal to $2$; when $x_1+x_2$ is equal to $1$ and so on.

• Your thought is correct. You have three problems, one for each sum of $x1+x2$. Are you familiar with stars and bars? Search the site or Wikipedia for it. – Ross Millikan Aug 24 '18 at 5:22
• Yes but the thing I want to know is is this using principle of inclusion and exclusion here.The answer is 24C2 +2*23C2 +3*22C2.I am not sure why they are multiplying by 2 and 3,Could you elaborate please. – Sparsh Aug 24 '18 at 5:33
• I think I got it.Please let me know if my reasoning is correct.So – Sparsh Aug 24 '18 at 5:42
• The answer you stated is correct. It is obtained by treating the cases $x_1 + x_2 = 0$, $x_1 + x_2 = 1$, and $x_1 + x_2 = 2$ separately, then adding the results. – N. F. Taussig Aug 24 '18 at 8:11