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 ) ∈ K [ n ] {\displaystyle 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 q i = ∑ k = i r ( k i ) p k , b = max i = 0 , … , r ( deg ( q i ) − i ) , α ( n ) = ∑ i = 0 , … , r deg ( q i ) − i = b lc ( q i ) n i _ , d α = max { n ∈ N : α ( n ) = 0 } ∪ { − ∞ } {\displaystyle {\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.4567
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.8 The algorithm returns the general polynomial solution of a recurrence equation.
Applying the formula for the degree bound on the recurrence equation ( n 2 − 2 ) y ( n ) + ( − n 2 + 2 n ) y ( n + 1 ) = 2 n , {\displaystyle (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 2 n = ( n 2 − 2 ) y ( n ) + ( − n 2 + 2 n ) y ( n + 1 ) = ( y 1 + y 2 ) n 2 + ( 2 y 0 + 2 y 2 ) n − 2 y 0 . {\displaystyle 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 ( 0 1 1 2 0 2 − 2 0 0 ) ( y 0 y 1 y 2 ) = ( 0 2 0 ) {\displaystyle {\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} .
Abramov, Sergei A. (1989). "Problems in computer algebra that are connected with a search for polynomial solutions of linear differential and difference equations". Moscow University Computational Mathematics and Cybernetics. 3. ↩
Petkovšek, Marko (1992). "Hypergeometric solutions of linear recurrences with polynomial coefficients". Journal of Symbolic Computation. 14 (2–3): 243–264. doi:10.1016/0747-7171(92)90038-6. ISSN 0747-7171. https://doi.org/10.1016%2F0747-7171%2892%2990038-6 ↩
Abramov, Sergei A.; Bronstein, Manuel; Petkovšek, Marko (1995). "On polynomial solutions of linear operator equations". Proceedings of the 1995 international symposium on Symbolic and algebraic computation - ISSAC '95. ACM. pp. 290–296. CiteSeerX 10.1.1.46.9373. doi:10.1145/220346.220384. ISBN 978-0897916998. S2CID 14963237. 978-0897916998 ↩
Weixlbaumer, Christian (2001). Solutions of difference equations with polynomial coefficients. Diploma Thesis, Johannes Kepler Universität Linz https://www.risc.jku.at/research/combinat/software/DiffTools/pub/weixlbaumer01.pdf ↩
Petkovšek, Marko; Wilf, Herbert S.; Zeilberger, Doron (1996). A=B. A K Peters. ISBN 978-1568810638. OCLC 33898705. 978-1568810638 ↩