Q:

How to solve this recurrence equation?$A_{n,k}=(n+1-k)A_{n-1,k-1}+(k+1)A_{n-1,k+1}$?

How to solve this recurrence equation?
$$A_{n,k}=(n+1-k)A_{n-1,k-1}+(k+1)A_{n-1,k+1},n=1,2,3,...;k=0,1,2,...$$
and
$$A_{1,0}=1,A_{1,1}=1,A_{2,0}=1,A_{2,1}=2$$
When I studied the following formula, I found the recursive formula, but I couldn't solve it：
$$g_n(x)=\sin^nx(-1)^{n-1}\frac{d^{n-1}}{dx^{n-1}}\left(\frac{1+\cos x}{\sin x}\right)\qquad(1)$$
\begin{align}
g_1(x)&=1+\cos x\\
g_2(x)&=1+2\cos x+\cos ^2x\\
...\\
g_n(x)&=\sum_{k=0}^{n}A_{n,k}\cos ^kx
\end{align}
Any help would be appreciated.

A:

The coefficients are listed in OEIS A198895 in reverse order. No closed form is given there, but a useful recurrence if your cos(x) are substituted by the variable x of the polynomials there.

