This question is related to this one, but the answers there do not explain my confusion.
This is exercise 20 in page 28 in the book generatingfunctionology:
Let $f(n,m,k)$ be the number of strings of $n$ $0$'s and 1's that contain exactly $m$ $1$'s, no $k$ of which are consecutive. Then
(a) Find a recurrence formula for $f$. It should have $f(n,m,k)$ on the left side, and exactly three terms on the right.
(b) Find, in simple closed form, the generating functions
$$ F_k(x,y)=\sum_{n,m\geq 0}f(n,m,k)x^ny^m\quad(k=1,2,...)$$
Here's what I have:
I didn't get exactly three terms in the recurrence, but I did come up with one plausible. Well, we want to use $n-m$ $0$'s to separate $m$ $1$'s. That's the same as putting $m$ balls into $n-m+1$ ordered boxes, and each box can at most contain $k-1$ balls. We divide the cases by how many balls the last box has: it could be $0,1,...,k-1$. Hence we have the recurrence relation:
$$f(n,m,k)=\sum_{i=1}^{k}f(n-i,m-i+1,k)$$
This recurrence should hold for arbitrary $n,m,k$ as long as we specify the appropriate initial values, or at least it should hold for $k$ large enough. (This might be where I ran into problems but I can not see it immediately).
However, when I carry this to the next part I am confused, because
\begin{aligned} F_k(x,y)& = \sum_{n,m\geq 0}f(n,m,k)x^ny^m \\ & = \sum_{n,m\geq 0}\sum_{i=1}^{k}f(n-i,m-i+1,k)x^ny^m \\ & = \sum_{i=1}^k\sum_{n,m\geq 0}f(n-i,m-i+1,k)x^ny^m \\ & = \sum_{i=1}^kx^iy^{i-1}\sum_{n,m\geq 0}f(n-i,m-i+1,k)x^{n-i}y^{m-i+1}\\ & = \sum_{i=1}^kx^iy^{i-1}F_k(x,y) \end{aligned} The second to bottom equality holds in my mind because $f(m,n,k)=0$ if either of $m$ or $n$ is $0$. However, it confuses me since at the end the equation implies $F_k(x,y)=0$?
Where did I go wrong? Any kind of help would be appreciated.
Your recurrence relation needs a base case: as written, it does not hold when $n=0$. $$ f(0,0,k) = 1\\\qquad\;\;\;\;\;\;\;\;\;\; f(0,m,k) = 0\qquad (m>0) $$ Incorporating this into your generating function calculations should allow you to solve for $F$.