Backend software engineer with focus on building infrastructure and distributed systems.
MSc in Computer Science, 2011
Technion -- Israel Institute of Technology
This post extends the generating-function technique from the two-variable recursion to a three-variable case. I originally wrote this as an answer to a Math Stack Exchange question; here it is adapted for the blog with clearer exposition and code.
We want to solve the recurrence
$a_{n,m,k} = 2a_{n-1,m-1,k-1} + a_{n-1,m-1,k}$ $ + a_{n,m-1,k-1} + a_{n-1,m,k-1}$
where $m$, $n$, $k$ are nonnegative integers, with boundary conditions:
A subtlety: $a_{1,0,1}$ is not defined by the recurrence alone, since it would require values like $a_{0,-1,0}$. We take $a_{n,m,k} = 0$ whenever any subscript is negative.