# Find all four digit numbers such that sum of digits is $10$.

Find all four digit numbers such that sum of digits is $$10$$.

If $$x_1x_2x_3x_4$$ is our number then $$x_1+x_2+x_3+x_4=10$$. Number of solutions using stars and bars is $$C_{13}^{10}$$ which is equal to $$286$$. But we also need to subtract cases when we have $$10$$ as a digit which we have $$4$$ cases so answer should be $$282.$$ But answer is $$219$$ can you help to understand where is problem?

• Did you include $0235$? Commented Jul 3, 2022 at 14:42

By four digit numbers, we mean that the first digit can't be $$0$$ (otherwise it'll be lesser digit number). So $$x_1 \geq 1$$
So, the answer is the number of non-negative solutions to the equation $$x_1 + x_2 + x_3 + x_4 = 9$$ Why do we subtract $$1$$? Consider already adding the minimum $$1$$, so equation becomes $$(x_1 + 1) + x_2 + x_3 + x_4 = 10$$ The number of solutions is $$\binom{9 + 4 - 1}{4 - 1} = 220$$But, we have to subtract $$1$$ case where the entire $$9$$ is given to the first digit (so it becomes $$10$$ which isn't a digit). So, answer = $$220 - 1 = \boxed{219}$$