3

How many numbers in between 4000 and 9999 have sum of digits equal to ten?

My attempt

My thinking was to use exponential generating functions because 4510 is not equal to 5401 so the order should matter, which would imply (from what I have learned) that exponential generating functions is the correct one.

So I set it up as

$(\frac{x^4}{4!}+\frac{x^5}{5!} \dots \frac{x^9}{9!})*(\frac{1}{0!} + \frac{x}{1!} \dots \frac{x^9}{9!})^3$

But based on How many numbers between $100$ and $900$ have sum of their digits equal to $15$? and my professor as well, one should use ordinary generating functions, i.e.

$(x^4 + x^5 \dots x^9)*(1 + x \dots x^9)^3$

Why is it not correct to use exponential generating functions for this problem, and why is it correct to use ordinary generating functions? In this case, what would be question that the exponential generating function answers vs. what would be the question that the ordinary generating function answers? I question in a similar vein is also Kind of basic combinatorical problems and (exponential) generating functions

N. F. Taussig
  • 76,571
  • Your posting seems to indicate that you are not interested in a Stars and Bars approach, as is used here. If you are interested in that approach, and you have trouble implementing that approach yourself, please edit your question to indicate this. In that event, you will need to show work with respect to my alternative approach and indicate where you are having trouble. – user2661923 May 30 '22 at 18:52
  • @user2661923 The Stars and Bars method is for putting indistinguishable objects into distinguishable containers (so it is related to ordinary generating functions). To me, the numbers 0-9 are distinguishable and therefore one should not use that approach. Apparantly I am wrong when I think that, but I don't understand why. I don't have trouble with mechanically implementing either of them, my question is regarding which one is the correct one to choose and why – user5744148 May 30 '22 at 18:55
  • Re last comment, for what it's worth, the corresponding equation is $~x_1 + x_2 + x_3 + x_4 = 10~$ and $~x_1,x_2,x_3,x_4 \in \Bbb{Z_{\geq 0}}~$ and $~x_1 \geq 4~$ and $x_1,x_2,x_3,x_4 \leq 9.$ – user2661923 May 30 '22 at 18:55
  • Re my last comment, each satisfying solution $(x_1,x_2,x_3,x_4)$ represents a satisfying $4$ digit number. Does this make sense to you? – user2661923 May 30 '22 at 18:57
  • @user2661923 yes – user5744148 May 30 '22 at 18:58
  • Okay, then if you are interested in the Stars and Bars approach, and have trouble implementing the approach in the linked answer, you will need to show work in your posting, and then include a specific question in your posting which indicates where you are having trouble. – user2661923 May 30 '22 at 19:00
  • @user2661923 my problem is not with implementing the approach. I know the approach. When I set it up as an ordinary generating function, I get the right answer. My question is conceptual: why is it not correct to use an exponential generating function? Doesn't it answer the exact same question but the order matters, and to me the order should matter in this problem, but apparently it doesn't so that is what I'm trying to understand – user5744148 May 30 '22 at 19:08
  • I am totally ignorant of generating functions, let alone exponential generating functions. I have peripherally observed that when generating function gurus attack Stars and Bars problems, they always use ordinary generating functions. I have no idea why. However, again, without knowing why, I am fairly sure that exponential generating functions are not appropriate here. ...see next comment – user2661923 May 30 '22 at 19:12
  • I suggest that you edit your title to read "Why is it wrong to attack a Stars and Bars problem with exponential generating functions?" Then, I suggest that you edit / streamline your posting, and take all the thoughts that you have put in the comments and include them in a brief manner in your posting. – user2661923 May 30 '22 at 19:14
  • Also, to influence MathSE reviewers to react positively to your posting, you definitely want to show all your work, directly in the posting. So, if you have solved the problem with ordinary generating functions, show this work. – user2661923 May 30 '22 at 19:17
  • It is the setup of the problem that is my question, everything after that is easy. I have edited now – user5744148 May 30 '22 at 19:37
  • +1 : to your question, for your editing. – user2661923 May 30 '22 at 19:40

1 Answers1

4

Multiplying $n!$ times the coefficient of $x^n$ in

$$ \left(\frac{x^4}{4!} + \frac{x^5}{5!} + \cdots + \frac{x^9}{9!}\right) \left(\frac{1}{0!} + \frac{x}{1!} + \cdots + \frac{x^9}{9!}\right)^3 $$

gives the number of ways to put $n$ labeled balls in $4$ labeled bins, so that the first bin has at least $4$ balls and no bin has more than $9$ balls.

The coefficient of $x^n$ in

$$ (x^4 + x^5 + \cdots x^9)(1 + x + \cdots + x^9)^3 $$

gives the number of ways to put $n$ identical balls in $4$ labeled bins, so that the first bin has at least $4$ balls and no bin has more than $9$ balls.

So which is relevant to this problem? If we imagine putting balls into bins to represent 4-digit numbers, we'll find it makes sense to assign digits based on the count of balls in specific bins left-to-right, not caring about any color or numbers on the balls themselves, so the ordinary generating function helps.

The difference between the two balls-and-bins problems is whether the order or identity of the "balls" matters, but the fact that 4501 and 5401 are different outcomes relates to the order/identity of the "bins". In general the "balls" are the things being counted/added, and the "bins" are the categories or outcomes for groups of balls. For the four-digit number, the "balls" are sort of the imagined $1$ values repeated in each digit value, such as $3 = 1+1+1$.

aschepler
  • 9,449
  • Thanks! Just a follow up question so that I understand in a short similar problem: Lets say you want a 15 digit phone number (so again digits 0-9 in each position), and you want the number of 3's to be odd. Would that be an exponential generating function problem or an ordinary generating function problem? To me these two problems seems similar, but according to the solution, this other problem should be solved with exponential generating functions – user5744148 May 30 '22 at 20:59