Petkovšek's algorithm
Petkovšek's algorithm (also Hyper) is a computer algebra algorithm that computes a basis of hypergeometric terms solution of its input linear recurrence equation with polynomial coefficients.[src] Equivalently, it computes a first order right factor of linear difference operators with polynomial coefficients.[src] This algorithm was developed by Marko Petkovšek in his PhD-thesis 1992.[src] The algorithm is implemented in all the major computer algebra systems.[src]
Petkovšek's algorithm (also Hyper) is a computer algebra algorithm that computes a basis of hypergeometric terms solution of its input linear recurrence equation with polynomial coefficients.[src] Equivalently, it computes a first order right factor of linear difference operators with polynomial coefficients.[src] This algorithm was developed by Marko Petkovšek in his PhD-thesis 1992.[src] The algorithm is implemented in all the major computer algebra systems.[src] Let \mathbb{K} be a field of characteristic zero.[src] A nonzero sequence y(n) is called hypergeometric if the ratio of two consecutive terms is rational, i.e.[src] y (n+1) /y(n) \in \mathbb{K}(n) .[src] The Petkovšek algorithm uses as key concept that this rational function has a specific representation, namely the Gosper-Petkovšek normal form.[src] Let r(n) \in \mathbb{K}[n] be a nonzero rational function.[src] Then there exist monic polynomials a, b, c \in \mathbb{K} [n] and 0 \neq z \in \mathbb{K} such that r(n) = z \frac{a(n)}{b(n)} \frac{c(n+1)}{c(n)} and \gcd (a(n), b(n+k)) = 1 for every nonnegative integer k \in \N , \gcd (a(n), c(n))=1 and \gcd ( b(n), c(n+1))=1 .[src] This representation of r(n) is called Gosper-Petkovšek normal form.[src] These polynomials can be computed explicitly.[src] This construction of the representation is an essential part of Gosper's algorithm.[src] Petkovšek added the conditions 2.[src] and 3.[src] of this representation which makes this normal form unique.[src] Using the Gosper-Petkovšek representation one can transform the original recurrence equation into a recurrence equation for a polynomial sequence c(n) .[src] The other polynomials a(n),b(n) can be taken as the monic factors of the first coefficient polynomial p_0 (n) resp.[src] the last coefficient polynomial shifted p_r(n-r+1) .[src] Then z has to fulfill a certain algebraic equation.[src] Taking all the possible finitely many triples (a(n), b(n), z) and computing the corresponding polynomial solution of the transformed recurrence equation c(n) gives a hypergeometric solution if one exists.[src] In the following pseudocode the degree of a polynomial p(n) \in \mathbb{K}[n] is denoted by \deg (p (n)) and the coefficient of n^d is denoted by \text{coeff} ( p(n), n^d ) .[src] algorithm petkovsek is input: Linear recurrence equation \sum_{k=0}^r p_k(n) \, y (n+k) = 0, p_k \in \mathbb{K}[n], p_0, p_r \neq 0 .[src] output: A hypergeometric solution y if there are any hypergeometric solutions.[src] for each monic divisor a(n) of p_0(n) do for each monic divisor b(n) of p_r(n-r+1) do for each k=0,\dots,r do \tilde{p}_k (n)= p_k (n) \prod_{j=0}^{k-1} a(n+j) \prod_{i=k}^{r-1} b(n+i) d = \max_{k=0,\dots,r} \deg (\tilde{p}_k (n)) for each root z of \sum_{k=0}^r \text{coeff} (\tilde{p}_k (n), n^d ) z^k do Find non-zero polynomial solution c(n) of \sum_{k=0}^r z^k \,\tilde{p}_k(n) \, c(n+k)=0 if such a non-zero solution c(n) exists then r(n)=z \, a(n)/b(n) \, c(n+1)/c(n) return a non-zero solution y (n) of y (n+1) = r(n) \, y (n) If one does not end if a solution is found it is possible to combine all hypergeometric solutions to get a general hypergeometric solution of the recurrence equation, i.e.[src] a generating set for the kernel of the recurrence equation in the linear span of hypergeometric sequences.[src] Petkovšek also showed how the inhomogeneous problem can be solved.[src] He considered the case where the right-hand side of the recurrence equation is a sum of hypergeometric sequences.[src] After grouping together certain hypergeometric sequences of the right-hand side, for each of those groups a certain recurrence equation is solved for a rational solution.[src] These rational solutions can be combined to get a particular solution of the inhomogeneous equation.[src] Together with the general solution of the homogeneous problem this gives the general solution of the inhomogeneous problem.[src] The number of signed permutation matrices of size n \times n can be described by the sequence y(n) which is determined by the recurrence equation 4 (n+1)^2 \, y(n) + 2 \, y(n+1) + (-1) \, y(n+2) = 0 over \Q .[src] Taking a(n) = n+1,b(n)=1 as monic divisors of p_0 (n) = 4(n+1)^2, p_2(n) = -1 respectively, one gets z = \pm 2 .[src] For z=2 the corresponding recurrence equation which is solved in Petkovšek's algorithm is 4(n+1)^2 \, c(n) + 4(n+1)\, c(n+1) - 4(n+1)(n+2) \, c(n+2) = 0.[src] This recurrence equation has the polynomial solution c(n) = c_0 for an arbitrary c_0 \in \Q .[src] Hence r(n)=2 (n+1) and y(n) = 2^n \, n![src] is a hypergeometric solution.[src] In fact it is (up to a constant) the only hypergeometric solution and describes the number of signed permutation matrices.[src] a(n)=\sum_{k=0}^n{\binom{n}{k}^2\binom{n+k}{k}^2}, coming from Apéry's proof of the irrationality of \zeta(3) , Zeilberger's algorithm computes the linear recurrence (n+2)^3 \, a(n+2)-(17n^2+51n+39)(2n+3) \, a(n+1)+(n+1)^3 \, a(n)=0.[src] Given this recurrence, the algorithm does not return any hypergeometric solution, which proves that a(n) does not simplify to a hypergeometric term.[src] ==External links== Mathematica implementation by Petkovšek[src]
45 sentences · 45 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Petkovšek's algorithm." encyclopegia.org, 2025, https://encyclopegia.org/wiki/petkov-ek-s-algorithm. Accessed 01 December 2026.
Chicago
"Petkovšek's algorithm." encyclopegia.org. Accessed December 1, 2026. https://encyclopegia.org/wiki/petkov-ek-s-algorithm.
APA
encyclopegia.org. (2025). Petkovšek's algorithm. Retrieved December 1, 2026, from https://encyclopegia.org/wiki/petkov-ek-s-algorithm
Accessed December 1, 2026 · CC BY-SA 4.0 · citation page · JSON