I have a simple question from text-book about this subject to see if I got it right.
Say I have a natural number below 1000, and I need to find all combinations of it's digits that their sum will be 14.
Now it basically:
0<=x1,x2,3<=9, with x1 + x2 + x3 = 14.
Going the inclusion - exclusion way, the solution seems to be:
|U| = D(3,14)
|S1|=|S2|=|S3| = D(3,4)
So the answer:
|U|-|S1|+|S2|-|S3| = D(3,14) - D(3,4)
Seems a bit too easy, can anyone comments
Thanks!
I count $\binom{14+3-1}{3-1}=\binom{16}2$ unrestricted solutions to $x_1+x_2+x_3=14$ in non-negative integers. The equation $x_1+x_2+x_3=4$ has $\binom{4+3-1}{3-1}=\binom62$ such solutions, so there are $\binom62$ solutions to the first equation that have $x_1>9$. Thus, there are $3\binom62$ solutions to $x_1+x_2+x_3=14$ in which one of the variables exceeds $9$. It’s impossible for two to exceed $9$, so the final total is
$$\binom{16}2-3\binom62=75\;.$$