[Math] $4$-digit numbers whose digit sum equal $10$

combinatorics

How many $4$-digit numbers are there whose digit sum equals $10$?

For example, $2017$ is such a $4$-digit number.

I got this from a $10$th grade math competition review. I asked my algebra-$2$ teacher and she doesn't know how to solve it.

Best Answer

Reword this as finding the number of integer solutions to the system

$$\begin{cases} x_1+x_2+x_3+x_4=10\\ 1\leq x_1\color{grey}{\leq 9}\\ 0\leq x_2\color{grey}{\leq 9}\\0\leq x_3\color{grey}{\leq 9}\\ 0\leq x_4\color{grey}{\leq 9}\end{cases}$$

Ignoring the upper bound conditions for now, count the number of solutions to the above using a standard stars and bars argument.

Then, noticing that none of the upper bound conditions could possibly be violated for $x_2,x_3,x_4$ (while still satisfying the sum and all lower bounds), and only one outcome violates the first upper bound condition, subtract one to correct the overall count.


Change variable $x_1-1=y_1$ you have system $y_1+x_2+x_3+x_4=9$ and $0\leq y_1,0\leq x_i$. By stars and bars there are $\binom{9+4-1}{4-1}=\binom{12}{3}$ solutions ignoring upperbounds, making final total $\binom{12}{3}-1=220-1=219$