TITLE: Tricky two-dimensional recurrence relation
QUESTION [6 upvotes]: I would like to obtain a closed form for the recurrence relation
$$a_{0,0} = 1,~~~~a_{0,m+1} = 0\\a_{n+1,0} = 2 + \frac 1 2 \cdot(a_{n,0} + a_{n,1})\\a_{n+1,m+1} = \frac 1 2 \cdot (a_{n,m} + a_{n,m+2}).$$
Even obtaining a generating function for that seems challenging. Is there a closed form for the recurrence relation or at least for the generating function? Alternatively, is there a closed form for $a_{n,0}$?

REPLY [5 votes]: Set $b_{n,m}=2^na_{n,m}$ if $m\geq 0$, and set $b_{n,m}=b_{n,-m-1}$ if $m<0$. Then the relation simplify to
$$
  b_{0,m}=f(m), \quad b_{n+1,m}=b_{n,m-1}+b_{n,m+1}+2^{n+2}f(m),
$$
where $f(0)=f(-1)=1$, $f(m)=0$ otherwise.
Now define $c_{n,m}$ in the same way, but without a constant term:
$$
  c_{0,m}=f(m), \quad c_{n+1,m}=c_{n,m-1}+c_{n,m+1}.
$$
Then it is clear that $c_{n,m}={n\choose \lfloor \frac{n-m}2\rfloor}$, where ${a\choose b}=0$ if $b\notin[0,a]$. On the other hand, the constant terms in the relations for $b_{n,m}$ merely add some more multiples of the $c_{i,m}$, so that
$$
  b_{n,m}=c_{n,m}+\sum_{0<k\leq n} 2^{k+1}c_{n-k,m}=-c_{n,m}+\sum_{0\leq k\leq n} 2^{k+1}c_{n-k,m}\\
  =-{n\choose \lfloor \frac{n-m}2\rfloor}+2\sum_{0\leq k\leq n-m} 2^k{n-k\choose \lfloor \frac{n-k-m}2\rfloor}.
$$

If $m=0$, ths simplifies as
$$
  b_{n,0}=-{n\choose \lfloor \frac{n}2\rfloor}
  +2\sum_{0\leq k\leq n/2}2^{2k}{n-2k\choose \lfloor \frac{n-2k}2\rfloor}
  +2\sum_{0\leq k\leq (n-1)/2}2^{2k+1}{n-2k-1\choose \lfloor \frac{n-2k-1}2\rfloor}.
$$
Recall that ${2a\choose a}=2{2a-1\choose a-1}$, so these sums are almost the same.
Say, if $n$ is even, then
$$
  b_{n,0}=-{n\choose \frac{n}2}-2^{n+1}
    +4\sum_{0\leq k\leq n/2}2^{2k}{n-2k\choose \frac{n-2k}2}
  =-{n\choose \frac{n}2}-2^{n+1}+4\frac{(n+1)!}{\frac{n}2!^2}
$$
(for the last sum, see Philippe Deléham's comment at http://oeis.org/A002457). Simplifying a bit, we get
$$
  b_{n,0}=(4n+3){n\choose \frac n2}-2^{n+1},
$$
which agrees with Per Alexandersson's formula.
The computation for odd $n$ is similar (one needs to separate the first term in the first sum of the general formula for $b_{n,0}$).