# Polynomial solutions of P-recursive equations

In mathematics a P-recursive equation can be solved for polynomial solutions. Sergei A. Abramov in 1989 and Marko Petkovšek in 1992 described an algorithm which finds all polynomial solutions of those recurrence equations with polynomial coefficients. The algorithm computes a degree bound for the solution in a first step. In a second step an ansatz for a polynomial of this degree is used and the unknown coefficients are computed by a system of linear equations. This article describes this algorithm.
In 1995 Abramov, Bronstein and Petkovšek showed that the polynomial case can be solved more efficiently by considering power series solution of the recurrence equation in a specific power basis (i.e. not the ordinary basis (x$^n$)$_{n∈N}${\textstyle (x^{n})_{n\in \mathbb {N} }}).
Other algorithms which compute rational or hypergeometric solutions of a linear recurrence equation with polynomial coefficients also use algorithms which compute polynomial solutions.

## Degree bound

Let K{\textstyle \mathbb {K} } be a field of characteristic zero and ∑$_{k=0}$$^r$p$_k$(n)y(n+k)=f(n){\textstyle \sum _{k=0}^{r}p_{k}(n)\, y(n+k)=f(n)} a recurrence equation of order r{\textstyle r} with polynomial coefficients p$_k$∈K[n]{\textstyle p_{k}\in \mathbb {K} [n]}, polynomial right-hand side f∈K[n]{\textstyle f\in \mathbb {K} [n]} and unknown polynomial sequence $y(n)\in \mathbb {K} [n]$. Furthermore deg⁡(p){\textstyle \deg(p)} denotes the degree of a polynomial p∈K[n]{\textstyle p\in \mathbb {K} [n]} (with deg⁡(0)=−∞{\textstyle \deg(0)=-\infty } for the zero polynomial) and lc(p){\textstyle {\text{lc}}(p)} denotes the leading coefficient of the polynomial. Moreover let${\begin{aligned}q_{i}&=\sum _{k=i}^{r}{\binom {k}{i}}p_{k},&b&=\max _{i=0,\dots ,r}(\deg(q_{i})-i),\\\alpha (n)&=\sum _{i=0,\dots ,r \atop \deg(q_{i})-i=b}{\text{lc}}(q_{i})n^{\underline {i}},&d_{\alpha }&=\max\{n\in \mathbb {N} \,:\,\alpha (n)=0\}\cup \{-\infty \}\end{aligned}}$for i=0, …, r{\textstyle i=0, \dots , r} where n$^{i_}$=n(n−1)⋯(n−i+1){\textstyle n^{\underline {i}}=n(n-1)\cdots (n-i+1)} denotes the falling factorial and N{\textstyle \mathbb {N} } the set of nonnegative integers. Then deg⁡(y)≤max{deg⁡(f)−b, −b−1, d$_α$}{\textstyle \deg(y)\leq \max\{\deg(f)-b, -b-1, d_{\alpha }\}}. This is called a degree bound for the polynomial solution y{\textstyle y}. This bound was shown by Abramov and Petkovšek.

## Algorithm

The algorithm consists of two steps. In a first step the degree bound is computed. In a second step an ansatz with a polynomial y{\textstyle y} of that degree with arbitrary coefficients in K{\textstyle \mathbb {K} } is made and plugged into the recurrence equation. Then the different powers are compared and a system of linear equations for the coefficients of y{\textstyle y} is set up and solved. This is called the method undetermined coefficients. The algorithm returns the general polynomial solution of a recurrence equation.

## Example

Applying the formula for the degree bound on the recurrence equation$(n^{2}-2)\,y(n)+(-n^{2}+2n)\,y(n+1)=2n,$over Q{\textstyle \mathbb {Q} } yields deg⁡(y)≤2{\textstyle \deg(y)\leq 2}. Hence one can use an ansatz with a quadratic polynomial y(n)=y$_2$n$^2$+y$_1$n+y$_0${\textstyle y(n)=y_{2}n^{2}+y_{1}n+y_{0}} with y$_0$, y$_1$, y$_2$∈Q{\textstyle y_{0}, y_{1}, y_{2}\in \mathbb {Q} }. Plugging this ansatz into the original recurrence equation leads to$2n=(n^{2}-2)\,y(n)+(-n^{2}+2n)\,y(n+1)=(y_{1}+y_{2})\,n^{2}+(2y_{0}+2y_{2})\,n-2y_{0}.$This is equivalent to the following system of linear equations${\begin{aligned}{\begin{pmatrix}0&1&1\\2&0&2\\-2&0&0\end{pmatrix}}{\begin{pmatrix}y_{0}\\y_{1}\\y_{2}\end{pmatrix}}={\begin{pmatrix}0\\2\\0\end{pmatrix}}\end{aligned}}$with the solution y$_0$=0, y$_1$=−1, y$_2$=1{\textstyle y_{0}=0, y_{1}=-1, y_{2}=1}. Therefore the only polynomial solution is y(n)=n$^2$−n{\textstyle y(n)=n^{2}-n}.