Using generating functions to count

151 Views Asked by At

I have an assignment question that asks "use generating functions to calculate the number of integers between $100,000$ and $999,999$ the sum of whose digits is $k$" I am familiar with generating functions, but have no idea how to begin. A nudge in the right direction would be appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

We can encode a selection of the left-most digit $d$ which fulfills $1\leq d \leq 9$ by \begin{align*} x^1+x^2+x^3+\cdots+x^9=x\left(1+x+x^2+\cdots+x^8\right)=x\frac{1-x^9}{1-x} \end{align*} The selection of the other digits can be encoded by \begin{align*} x^0+x^1+x^2+\cdots+x^9=\frac{1-x^{10}}{1-x} \end{align*}

It is convenient to use the coefficient of operator $[x^k]$ to denote the coefficient of $x^k$ of a generating series.

We obtain as number of integers $x$ with $100000\leq x \leq 999999$ with sum of digits equal to $k$ \begin{align*} [x^k]x\frac{1-x^9}{1-x}\left(\frac{1-x^{10}}{1-x}\right)^5=[x^k]\frac{x(1-x^9)(1-x^{10})^5}{(1-x)^6} \end{align*}