How many four digit numbers have the sum of the digits equal to 31? Answer is 56. I found below solution from the web but not quite understands the reason.
"We need a sum of 31 and I've seen many people post solutions, which involved lot of inclusion. So I'll share a simple trick. If the sum of digits is close to max possible value, then start from the max possible value.
For example, in this question first imagine that you have given 9 to each of the four digits.
Now, the total will 36 but we required 31, so we need to take back 5.
The number of ways of taking 5 back from 4 boxes (places of the number) must be same as the number of ways of distributing 5 to 4 boxes.
Which would be
(5+4-1)C(4-1) =8C3 =56"
MY questions is why the number of ways taking 5 back from 4 boxes must be same as number of ways distributing 5 to 4 boxes. Can someone explain the reason and let me understands it more? or is there a more easy way to approach this question in a star and bars way?
Thanks!!!
"We need a sum of 31 and I've seen many people post solutions, which involved lot of inclusion. So I'll share a simple trick. If the sum of digits is close to max possible value, then start from the max possible value.
For example, in this question first imagine that you have given 9 to each of the four digits.
Now, the total will 36 but we required 31, so we need to take back 5.
The number of ways of taking 5 back from 4 boxes (places of the number) must be same as the number of ways of distributing 5 to 4 boxes.
Which would be
(5+4-1)C(4-1) =8C3 =56"
MY questions is why the number of ways taking 5 back from 4 boxes must be same as number of ways distributing 5 to 4 boxes. Can someone explain the reason and let me understands it more? or is there a more easy way to approach this question in a star and bars way?
Thanks!!!