Multibasic and Mixed Gosper's Algorithm Marko Petkovsek
Andrej Bauer
Department of Computer Science Carnegie Mellon University Pittsburgh PA 15213, U.S.A.
Department of Mathematics University of Ljubljana Jadranska 19, 1111 Ljubljana, Slovenia
[email protected]
[email protected]
November 2, 1997 Abstract
Gosper's summation algorithm nds a hypergeometric closed form of an inde nite sum of hypergeometric terms, if such a closed form exists. We generalize his algorithm to the case when the terms are simultaneously hypergeometric and multibasic q-hypergeometric. We also provide algorithms for computing hypergeometric canonical forms of rational functions and for nding polynomial solutions of recurrences in the multibasic and mixed case.
1 Introduction and notation
Let F be a eld of characteristic zero and htn i1 n=0 a sequence of elements from F which is eventually non-zero. Call tn : hypergeometric , if there are polynomials p1 ; p2 2 F [x] such that p1 (n)tn+1 = p2 (n)tn for all n; q-hypergeometric or basic hypergeometric , if there are polynomials p1 ; p2 2 F [x] such that p1 (qn )tn+1 = p2 (qn )tn for all n, where q 2 F is a constant called the base; multibasic hypergeometric , if there are polynomials p1 ; p2 2 F [y1 ; : : : ; ym ] such that p1 (q1n ; : : : ; qmn )tn+1 = p2 (q1n ; : : : ; qmn )tn for all n, where q1 ; : : : ; qm 2 F are constants called the bases; multibasic and mixed hypergeometric (mmHS, for short), if there are polynomials p1 ; p2 2 n )tn+1 = p2 (n; q n ; : : : ; q n )tn for all n. F [x; y1 ; : : : ; ym ] such that p1 (n; q1n ; : : : ; qm m 1 The celebrated Gosper's algorithm [7, 8] nds hypergeometric solutions fn of the inhomogeneous rstorder recurrence fn+1 ? fn = tn where tn is a given hypergeometric sequence. Besides its obvious use for inde nite hypergeometric summation, it also plays a crucial role in the algorithms for de nite hypergeometric summation, construction of annihilating recurrences, and automated veri cation of identities [17, 18]. Therefore it is not surprising that analogous algorithms have been designed for many other settings, e.g., integration of hyperexponential functions [4], basic [16, 15] and bibasic hypergeometric summation [13]. We present in Section 6 an analogue of Gosper's algorithm for the multibasic and mixed hypergeometric case. Our algorithm m&m-Gosper1 is a common generalization of algorithms presented in [8, 16, 13]. Sections 2 and 3 give the required algebraic and algorithmic preliminaries, while in Section 5 we develop the multibasic and mixed hypergeometric canonical form of rational functions. Although in Gosper's
corresponding author 1
available as GosperSum in
Mathematica
package gosper.m at http://www.cis.upenn.edu/ ~ wilf/AeqB.html
1
algorithm only rst-order recurrences are checked for polynomial solutions, we provide in Section 4 algorithm m&m-Poly2 which nds all polynomial solutions of inhomogeneous, parametric, multibasic and mixed recurrences with polynomial coecients. The set of integers is denoted by Z, the set of nonnegative integers by N 0 , and the eld of rational numbers by Q . If n; m 2 N 0 and a = (a1 ; a2 ; : : : ; am ), b = (b1 ; b2 ; : : : ; bm ) are m-tuples of elements of a ring, we write ab for the componentwise product (a1 b1 ; a2 b2 ; : : : ; am bm ), and an for the componentwise power (an1 ; an2 ; : : : ; anm ). If = (1 ; 2 ; : : : ; m ) 2 N m0 then we write a for the power product a1 1 a2 2 amm . We say that two multivariate polynomials over a eld are coprime if they do not have a common non-constant factor. When a and b are coprime, we write a ? b. When S is a set of polynomials and a ? b for all b 2 S , we write a ? S .
2 Algebraic preliminaries
Let F be a eld of characteristic zero. Let q1 ; : : : ; qm 2 F n f0g, and suppose that for any integers k1 ; : : : ; km 2 Z (1) q1k1 q2k2 qmkm = 1 =) k1 = k2 = = km = 0: This seems to be the right generalization of the condition that p q is not ap root of unity in the qhypergeometric case (see [3]). For example, if F = R , q1 = 3 2 and q2 = 5 2, then q13 q2?5 = 1, and p we should have chosen q = 15 2 in the rst place. We denote q = (q1 ; : : : ; qm ). Let y = (y1 ; y2 ; : : : ; ym ) be an m-tuple of variables, F [x; y] the ring of polynomials over F in x and y, and F (x; y) the corresponding rational function eld. We de ne a dierence operator E on F (x; y) by stipulating that E be xed on F , that Ex = x + 1, and that Eyk = qk yk for k = 1; : : : ; m. Note that E is inversive, that F (x; y) is a dierence eld, and that F [x; y] is a dierence subring of F (x; y) (see [6] for terminology). Let M be the set of power products in y1 ; y2 ; : : : ; ym : M = fy1k1 y2k2 ymkm ki 2 N 0 for i = 1; : : : ; mg: If u = y1k1 y2k2 ymkm 2 M, we write u(q) for the corresponding power product of the bases q1k1 q2k2 qmkm . Note that Eu = u(q)u for all u 2 M. As a multiplicative monoid, M is obviously isomorphic to N m0 , them direct product of m copies of the additive monoid N 0 . We denote by an admissible term order in N 0 , which is a total order satisfying 1. 0 , 2. ) + + for all ; ; 2 N m0 . An example of an admissible term order is the lexicographic order lex , with lex when 6= and k < k where k = minfi; i 6= i g. De nition 2.1 Let ; 2 N m0 . Then we write
whenever i i for all i between 1 and m. Clearly, (N m0 ; ) is a partial order isomorphic to (M; j) where j denotes divisibility of power products, and is contained in any admissible term order: ) ; for all ; 2 N m0 : We adjoin to N m0 an absorbing bottom element, ?, such that for all 2 N m0 ? ; ? + = + ? = ?: De nition 2.2 Let p 2 F [x; y]. Write
p(x; y) =
X
2N0m
p (x)y =
X
i2N0
ci (y)xi
where only nitely many p 2 F [x] and ci 2 F [y] are non-zero. 2 available
as MixedPoly in
Mathematica
package gosper.m at http://www.cis.upenn.edu/ ~ wilf/AeqB.html
2
(2)
1. We de ne the multidegree of p in y as
degy p(x; y) =
max f 2 N m0 ; p 6= 0g; p 6= 0; ?; p = 0:
2. We write [y ] p(x; y) for p (x) and [xi ] p(x; y) for ci (y) in (2). 3. When degy p we write p = o(y ). 4. Let = degy p. We call p mixed monic when [y ] p(x; y) is monic as a univariate polynomial in x. Note that the concepts of multidegree and mixed monicity are relative to the chosen term order . By convention, gcd(a; b) always denotes a mixed monic greatest common divisor of a; b 2 F [x; y]. Lemma 2.3 Let F be a eld of characteristic zero and r1 ; : : : ; rk 2 F n f0g, with ri 6= rj for i 6= j . Let d1 ; d2 ; : : : ; dk 2 N 0 and d = d1 + d2 + + dk . Then the d functions gij : N 0 ! F , de ned by gij (n) = nj rin , for i = 1; : : : ; k, j = 0; : : : ; di ? 1, are linearly independent in the vector space N 0 ! F over F . This is well known, and can be proved by evaluating the generalized Vandermonde determinant composed of the values of gij (n) for n = 0; 1; : : : ; d ? 1. We give an alternative short proof using generating functions.
Proof: De ne subspaces L ; L of N ! F . First, let L be the subspace generated by the gij , L = fn: Pri Pi (n)rin Pi 2 F [n]; deg Pi < di g. As L is generated by d elements, dim L d. Second, let q 2 F [x] be the polynomial k Y q(x) = (1 ? ri x)di ; 1
2
0
1
1
1
=1
1
i=1
and let L2 be the space of sequences whose generating function is a proper fraction with xed denominator P n q(x), L2 = ff : N 0 ! F 1 f ( n=0 n)x = p(x)=q (x); p 2 F [x]; deg p < dg. Clearly, L2 is isomorphic to the polynomial space fp 2 F [x]; deg p < dg, therefore dim L2 = d. Using partial fraction decomposition di r X X p(x) = Q p(x) cij = r j d q(x) i=1 (1 ? ri x) i i=1 j =1 (1 ? ri x)
and the binomial series expansion (1 ? ri x)?j = we nd that
1 X n=0
1 ?j (?rix)n = X n + j ? 1 r n xn ; n j?1 i n
=0
1 1 r di p(x) = X n = X xn X X cij n + j ? 1 rn : f ( n ) x q(x) n=0 j?1 i n=0 i=1 j =1
P
P
?
i cij n+j ?1 is a polynomial in Thus for any f 2 L2 we have f (n) = ri=1 Pi (n)rin , where Pi (n) = dj=1 j ?1 n of degree at most di ? 1. It follows that f 2 L1 , and so L2 L1 . As dim L2 = d and dim L1 d, we conclude that dim L1 = d as well. Therefore the d generators gij , i = 1; : : : ; k, j = 0; : : : ; di ? 1, of L1 are linearly independent. The ring of functions N 0 ! F contains a subring F [n:n; n:q1n ; : : : ; n:qmn ] (or shorter F [n; qn ]) of functions that are polynomials in n and q1n ; : : : ; qmn . Theorem 2.4 The ring of functions F [n; qn ] is isomorphic to the ring of polynomials F [x; y]. The n isomorphism : F [x; y] ! F [n; q ] maps x 7! n:n and yi 7! n:qin .
3
Proof: It is obvious that is an epimorphism. We show that it is a monomorphism. Let f 2 F [x; y]. Write f as
f=
k X
i=0 where p1 ; : : : ; pk 2 F [x], u1 ; : : : ; uk 2 M, and ui 6= uj k X
0 = f =
i=0
pi ui ; for i 6= j . Suppose f = 0:
pi(n)ui (q)n :
Because q1 ; : : : ; qn satisfy condition (1), ui (q) 6= uj (q) for i 6= j . The result now follows from Lemma 2.3. As a consequence, F [n; qn ] is an integral domain, and its eld of fractions F (n; qn ) is isomorphic to the rational function eld F (x; y). The map : F [x; y] ! F [n; qn ] de ned in Theorem 2.4 can be naturally extended to a map from F (x; y) to F (n; qn ). We de ne a dierence operator S on N 0 ! F by S : n:r(n) 7! n:r(n + 1). This makes F (n; qn ) a dierence eld and F [n; qn ] a dierence subring of F (n; qn ). The dierence operator S is inversive. As E = S , we see that is a dierence isomorphism of the two elds F (x; y) and F (n; qn ), as well as of the two rings F [x; y] and F [n; qn ]. Lemma 2.5 Let p 2 F [x; y] n f0g and 2 F . Then Ep = p if and only if p = ru for some r 2 F , u 2 M, and = u(q). Proof: Suciency is obvious. Suppose Ep = p. Write p as
p(x; y) =
n X i=1
pi (x) ui (y);
where u1 ; : : : ; un 2 M are pairwise dierent and p1 ; : : : ; pn 2 F [x] n f0g. It follows that X
i
pi (x) ui (y) = p = Ep =
Hence, for all i = 0; : : : ; n
X
i
pi (x + 1) ui (q) ui (y):
pi(x) = ui (q) pi (x + 1): By looking at the leading coecients in the above equation, we conclude that = ui (q) for all i = 1; : : : ; n. However, if it were the case that ui (q) = uj (q) for some i 6= j , condition (1) would be violated. It follows that n = 1, and p(x; y) = r(x) u(y) for some r 2 F [x] n f0g and u 2 M. From Ep = p we get r(x + 1) = r(x), which is only possible if r is a constant.
De nition 2.6 For 1 i m, we denote by i the endomorphism of F [x; y] which substitutes 0 for yi . Lemma 2.7 The endomorphisms i , 1 i m, commute with E and E? . Proof: Let S = fy ; y ; : : : ; ym g n fyi g and? p 2 F [x; y].?Consider p to be a polynomial in F [x; S ][yi ]. It is easy to check that Ei p = i Ep and E i p = i E p. 1
1
2
1
1
3 Algorithmic preliminaries
For polynomials a; b 2 F [x; y] n f0g such that a; b ? M, we will need to compute the set D(a; b) = fn 2 N 0 ; a 6? En bg of all nonnegative integers n such that a and En b have a non-constant common divisor. De ne polynomials R1 ; R2 ; : : : ; Rm ; R 2 F [x; y][; ] as polynomial resultants Ri (; ) = Resyi (a(x; y); b(x + ; y)) (1 i m); R(; ) = Resx (a(x; y); b(x + ; y)):
4
Here is a variable and = (1 ; 2 ; : : : ; m ) is an m-tuple of variables. Let
P (; ) = R(; )
m Y i=1
Ri (; ):
(3)
The following lemma leads to an algorithm for computing D(a; b): Lemma 3.1 D(a; b) = fn 2 N 0 ; P (n; qn ) = 0g. Proof: Forn n 2 N 0 , let n : F [x; y; ; ] ! F [x; y] be the evaluation homomorphism which substitutes n for and q for . It is easy to see that for any non-zero polynomial p 2 F [x; y], the homomorphic image n (p(x + ; y)) = p(x + n; qn y) = En p(x; y) is non-zero. Therefore, by the Homomorphism Lemma for resultants (see, e.g., [9, Lemma 7.3.1]), Ri (n; qn ) = n (Ri (; )) = Resyi (n (a(x; y)); n (b(x + ; y))) = Resyi (a; En b) (1 i m); R(n; qn ) = n (R(; )) = Resx (n (a(x; y)); n (b(x + ; y))) = Resx (a; En b): Thus we have the following chain of equivalences: n 2 D(a; b) () one of degx gcd(a; En b); degyi gcd(a; En b) is positive () one of Resx (a; En b); Resyi (a; En b) vanishes () one of R(n; qn ); Ri (n; qn ) vanishes
() R(n; qn )
m Y i=1
Ri (n; qn ) = 0
() P (n; qn ) = 0:
(4)
The second equivalence above follows from the well-known properties of polynomial resultants. Next we show how to nd integral solutions n of equation (4) in two special cases. 3.1
Transcendental bases
Let F = Q (q1 ; : : : ; qm ) where q1 ; : : : ; qm are algebraically independent over Q . Let p 2 F [x; y] n f0g. We look for n 2 N 0 such that p(n; q1n ; : : : ; qmn ) = 0: (5) We present a recursive algorithm for nding an upper bound for n. Once the bound is known, all integers between zero and the bound can be checked. In equation (5), the coecients are elements of F , which are rational functions of q1 ; : : : ; qm . We can clear the denominators and obtain an equation in which qi occur polynomially: r(n; q1 ; : : : ; qm ; q1n ; : : : ; qmn ) = 0; (6) where r 2 F [x; z1 ; : : : ; zm ; y1 ; : : : ; ym ] nf0g. We show how to reduce recursively the problem of nding an upper bound for solutions of (6). Consider all terms of r with lowest degree of ym , and let that degree be j . Among these terms, consider the one with the lowest degree of zm , and let d be that degree. The term has the form szmd ymj for some s 2 F [x; z1 ; : : : ; zm?1 ; y1 ; : : : ; ym?1 ] n f0g. Let M be an upper bound on natural solutions of equation s(n; q1 ; : : : ; qm?1 ; q1n ; : : : ; qmn ?1 ) = 0; (7) which we can get recursively. Then max(M; d) is an upper bound for solutions of (6). Suppose n > max(M; d). Then n is not a solution of (7), and the lowest power of qm that occurs in (6) is d + nj . Since this power occurs only in the term s(n)qmd qmnj , the term does not cancel, and n is not a solution of (6). The base case of the recursion is an equation r(n) = 0, where r 2 Q [x] n f0g. This can be handled easily, since any natural solution of this equation must divide the constant term (after we have cleared the denominators).
5
3.2
Rational bases
Suppose q1 ; : : : ; qm 2 Q . Let p 2 Q [x; y] n f0g. We consider the problem of nding n 2 N 0 such that p(n; q1n ; : : : ; qmn ) = 0: (8) Write p as
p=
k X i=1
pi ui ;
where p1 ; : : : ; pk 2 Q [x] n f0g, u1 ; : : : ; uk 2 M, and ui 6= uj for i 6= j . Equation (8) can be written as k X i=1
pi (n)ui (q)n = 0
(9)
Because bases q1 ; : : : ; qm satisfy condition (1), jui (q)j 6= juj (q)j for i 6= j . Let si = ui (q) for i = 1; : : : ; k. We may assume that js1 j < js2 j < < jsk j. Suppose pk (x) = ad xd + ad?1 xd?1 + + a0 . Equation (9) is equivalent to
ad nd snk +
d?1 X i=0
ai ni snk +
k?1 X i=1
pi (n) sni = 0
(10)
The rst term in (10) dominates the sum of the others. We only need a lower bound on n, such that the absolute value of the rst term is greater than the absolute value of the sum of the other terms. Then we can check all integers between zero and the lower bound. Let dom(a; b; k) be a function which gives an integer lower bound, such that for all n dom(a; b; k) it is true that an > bnk . Here a > 1, b > 0 and k 2 Z. Let = 1=(d + k). For i = 0; : : : ; d ? 1, de ne
1 Mi = aai d?i d Let Ki be the maximum absolute value of the coecients of pi . For i = 1; : : : ; k ? 1, de ne Ni = dom ssk ; 2aKi ; deg pi ? d i d Let N = max(2; M0 ; : : : ; Md?1 ; N1 ; : : : ; Nk?1 ). The choice of Mi ensures that jad nd snk j > jai ni snk j for all n N . The choice of Ki ensures that jpi (n)j < 2Ki ndeg pi for all n 2. Therefore, jad nd snk j > jpi (n)sni j for all n > N . This means that equation (8) does not have any solutions larger than N . We can nd all solutions of (8) by checking all integers between 0 and N .
4 Polynomial solutions
In this section we present an algorithm for nding all polynomial solutions f 2 F [x; y] of parametric inhomogeneous equations of the form s X Lf = g + j hj (11) where
j =1
L=
X i=0
pi E i
(12)
is a linear recurrence operator with polynomial coecients pi 2 F [x; y], j are free parameters to be determined, and g; hj 2 F [x; y] are given polynomials. More precisely, the problem is to compute a basis P of the ane space L?p 1 (g) where Lp : F [x; y] F s ! F [x; y] and Lp : (f; ) 7! Lf ? sj=1 j hj for
6
f 2 F [x; y] and 2 F s . Thus by a solution of (11) we mean a pair (f; ) with f 2 F [x; y] and 2 F s such that (11) is satis ed. As a special case, (11) includes inhomogeneous equations without parameters (when all hj = 0) as well as homogeneous equations (when also g = 0). The ability to solve parametric inhomogeneous equations is crucial if one wants to apply Zeilberger's Creative Telescoping algorithm [18] in the mixed multibasic case. Another reason for allowing linear parameters in the equation is the nature of our algorithm which nds the terms of the solution one by one, introducing new free parameters into the right hand side at each step. Let f (x; y) be a polynomial solution of (11). Write = 0max deg p ; (13) i y i pi; (x) = [y ] pi ; (14) d = 0max deg p (x); (15) i x i; pi;;d = [xd ] pi; (x);
rhs() = g +
s X j =1
j h j ;
(16)
(17)
' = degy f (x; y); (18) ' t(x) = [y ] f (x; y); (19) = degy rhs(); (20) r = [y ] rhs(); (21) where t 2 F [x] n f0g, pi; 2 F [x] and pi;;d 2 F . In (20) we regard j 's as variables over F (x), and rhs() as belonging to F (x; )[yP ]. Note that when the parameters j are given speci c values from F , the multidegree of rhs() = g + sj=1 j hj in y can be lower than . Lemma 4.1'Let L; ; pi;;d and ' be as given in (12){(18). If degy Lf + ', then ' = degy f satis es P (q ) = 0 where X P (x) = pi;;d xi (22) i=0
is the characteristic polynomial of L. Proof: From (19), Ei f = t(x + i)qi' y' + o(y' ), so Lf = T (x)y+' + o(y+' ) where
T (x) =
X i=0
pi; (x)qi' t(x + i):
(23)
If degy Lf + ' then T = 0. This is an ordinary recurrence relation with non-zero polynomial P solution t(x). As the coecient of xd+degx t in T (x) must vanish, i=0 pi;;d qi' = 0 as claimed. Let R denote the set of exponents of those roots of the characteristic polynomial (22) (if any) which are power products of the bases: R = f 2 N m0 ; P (q ) = 0g: (24) When R is empty we take max R = ?. The following lemma gives rise to an algorithm for nding all polynomial solutions of equation (11). Lemma 4.2 Let (f; 0 ) be a solution of (11) with f 2 F [x; y] and 0 2 F s . 1. If + max R then degy f max R. 2. Let + max R . (a) If then degy f ? . (b) If 6 then degy rhs(0 ) .
7
Proof: Let ' = degy f . Let T be as in (23). 1. + max R If T = 0 then ' 2 R, by Lemma 4.1. If T 6= 0 then degy Lf = + '. As degy rhs(0 ) , it follows that + ' + max R, so ' max R. In either case, ' max R as claimed. 2. + max R (a) If T = 0 then ' 2 R by Lemma 4.1, so ' max R and therefore + ' . If T = 6 0 then degy Lf = + '. As degy rhs(0 ) , it follows that + ' . In either case, ' ?
as claimed. (b) 6 Assume that degy rhs(0 ) = . If T = 0 then by Lemma 4.1, ' 2 R and degy Lf + ' + max R = degy rhs(0 ), a contradiction. If T 6= 0 then + ' = which implies that , contrary to the assumption. Both cases lead to contradiction, so degy rhs(0 ) as claimed.
Based on Lemma 4.2, we can nd the general solution (f; ) of equation (11) as follows: First compute the set R as given in (24). Then distinguish three cases: 1. + max R Set ' = max R and look for f in the form f = t(x)y' + f1 (25) where f1 = o(y' ). To nd t(x), apply the algorithm of [2] to T = 0 (an ordinary homogeneous recurrence relation). Then remove max R from R and nd f1 recursively by solving Lf1 = rhs() ? L (t(x)y') : (26) 2. + max R (a) Set ' = ? and look for f in the form (25). To nd t(x), apply the algorithm of [2] to T = r (an ordinary parametric inhomogeneous recurrence relation). Then remove max R from R (only in case that + max R = ), and nd f1 recursively by solving (26). (b) 6 Let = 0 be the solution of the system of linear algebraic equations for the free parameters obtained by equating0 the coecients of powers of x in r to zero. Then nd f recursively by solving Lf = rhs( ).
Remarks:
1. Note that in steps 1 and 2(a), t(x) can contain new free parameters which are then joined with the existing ones. This explains the need for allowing parameters in the right hand side of the equation. 2. In step 2(b), the number of free parameters will drop by the rank of the linear system to be solved. 3. If the ordinary recurrence in steps 1 or 2(a) has no polynomial solution, or the linear system in step 2(b) is unsolvable, then the original parametric recurrence has no polynomial solution, and the algorithm terminates unsuccessfully. 4. At each step, either the cardinality of the set R drops, or the multidegree = degy rhs() decreases in the admissible term order . As every admissible term order is a well-order, this assures termination of the algorithm. 5. Unless the algorithm terminates unsuccessfully, eventually R becomes empty and rhs() becomes 0. Then the only polynomial solution of (11) is f = 0. An iterative version of this tail-recursive algorithm called m&m-Poly is given in appendix A.
8
5 A canonical form
Let r 2 F (x; y) n f0g. Write r as
r = uv ab 0 ; 0 where u; v 2 M, a0 ; b0 2 F [x; y], a0 b0 ? M, ua0 ? vb0 , and b0 is mixed monic (Def. 2.2). There are nitely many h 2 N 0 such that a0 6? Eh b0 . Let 0 h1 < h2 < < hN be those natural numbers for which a0 and Ehi b0 have a common non-constant factor. According to Lemma 3.1, they are the natural roots of p(h) = P (h; qh ) where P is the polynomial given in (3), and can be found as described in section 3. Lemma 5.1 Consider the algorithm CanonicalForm in appendix B. De ne hN +1 = 1, and let 0 k i; j N , h 2 N 0 and h < hk+1 . Then ai ? Eh bj . Proof: Let S = fh1 ; : : : ; hN g. Suppose h 62 S . Since ai j a0 and bj j b0 and a0 ? Eh b0 , it follows that ai ? Eh bj . To prove the lemma for h 2 S , we use induction on k. When k = 0, there is nothing to prove because there is no h 2 S such that h < h1 . Assume that the lemma holds for all h 2 S , h < hk . We show that it holds for h = hk . Since ai j ak and bj j bk , it follows that gcd(ai ; Ehk bj ) divides gcd(ak ; Ehk bk ). Furthermore, hk gcd(ak ; Ehk bk ) = gcd( ask?1 ; E sbk?1 ) = 1 k k by the de nition of ak ; bk and sk in algorithm CanonicalForm. This completes the proof.
Theorem 5.2 Let r 2 F (x; y) n f0g. There exist polynomials a; b; c 2 F [x; y] n f0g such that 1. 2. 3. 4. 5.
b; c are mixed monic, c ? M, a ? Ek b for all k 2 N 0 , a ? c, b ? Ec, and
(27) r = ab Ecc : Proof: Let a; b; c be constructed by the algorithm CanonicalForm from appendix B. Conditions 1 and 2 are satis ed by construction, and condition 3 follows from Lemma 5.1 by taking i = j = k = N . Identity (27) is veri ed by: h
N Y i ?j +1 a Ec = u aN Y E si b c v bN i=1 j=1 E?j si =
= QuN a0 i=1 si
QN
i=1 E
?hi si
v b0
N Y i=1
ua si E?hi si = v b = r 0
0
Proof of 4: Suppose a 6? c. Then also aN 6? E?j si for some i and j such that 1 i N and 1 j hi . By de nition Ehi ?j bi?1 = Ehi ?j bi E?j si , so it follows that aN 6? Ehi ?j bi?1 . Since hi ? j < hi , this contradicts Lemma 5.1. Proof of 5: Suppose b 6? Ec. Then also bN 6? E?j si for some i and j such that 1 i N and 0 j hi ? 1. By de nition E?j ai?1 = E?j ai E?j si , so it follows that ai?1 6? Ej bN . Since j < hi , this contradicts Lemma 5.1.
Lemma 5.3 Let a; b; c; A; B; C 2 F [x; y] n f0g be polynomials such that a ? c, b ? Ec, c ? M, and A ? Ek B for all k 2 N 0 . If a Ec = A EC ; (28) b c B C then c divides C .
9
Proof: Let g = gcd(c; C ), d = c=g, and D = C=g. Then d ? D, a ? d, and b ? Ed. Clear denominators in (28) and cancel g Eg on both sides. The result A b d ED = a B D Ed shows that d j B Ed and Ed j A d. Using these two relations repeatedly, we nd that d j B EB Ek?1 B Ek d d j E?1 A E?2 A E?k A E?k d for all k 2 N 0 . Because d ? M, and F has characteristic zero, d ? Ek d and d ? E?k d for large enough k. It follows that d divides both B EB Ek?1 B and E?1 A E?2 A E?k A for large enough k. But these two polynomials are coprime by assumption, so d must be a constant. Hence, c divides C . Theorem 5.4 Let r 2 F [x; y] n f0g. Then the factorization of r described in Theorem 5.2 is unique. Proof: Suppose that a; b; c and A; B; C are two factorizations of r, as described in Theorem 5.2. Then r = a Ec = A EC :
b c B C By Lemma 5.3, c divides C , and vice versa. As c and C are mixed monic they must be equal, hence a=b = A=B . As a ? b, A ? B , and b; B are mixed monic, it follows that b = B and a = A as well. The factorization of non-zero rational functions described in Theorem 5.2 is thus a canonical form. We introduce special notation for it. De nition 5.5 Let r 2 F (x; y) n f0g be a non-zero rational function. We write (a; b; c) = C:f :(r) to denote the unique polynomials a; b; c 2 F [x; y] which satisfy the conditions of Theorem 5.2. Theorem 5.6 Let a; b 2 F [x; y]nf0g, and (A; B; C ) = C:f :(b=a). The homogeneous rst-order recurrence a Ef ? bf = 0 (29) has a non-zero polynomial solution f 2 F [x; y] if and only if A=B = u(q) for some u 2 M. In that case, f = u C for some 2 F n f0g. Proof: Suppose (29) has a non-zero solution f 2 F [x; y]. Write f = u v where 2 F n f0g, u 2 M and g ? M is mixed monic. Then C:f :(Ef=f ) = (u(q); 1; g). Since Ef = b = A EC ; f a B C (A; B; C ) = C:f :(Ef=f ) as well. It follows that A = u(q), B = 1 and C = g, so A=B = u(q) and f = u C. Conversely, if A=B = u(q) for some u 2 M, then f = u C is a non-zero solution of (29).
6 Generalized Gosper's algorithm Let Sn =
Pn?1
k=0 tk .
Clearly Sn satis es the rst-order recurrence Sn+1 ? Sn = tn : We consider the following problem: Given a sequence tn , decide if equation (30) has an mmHS solution Sn , and if so, nd it.
Let Sn and tn satisfy (30), with
Sn+1 =: Tn 2 F (n; qn ): Sn
10
(30)
Then the two quotients
?1 rn := tnt+1 = SSn+2 ??SSn+1 = T1 n?+11=T n n+1 n n and Rn := St n = S Sn? S = T 1? 1 n n+1 n n both belong to F (n; qn ). So tn must be an mmHS itself, and Sn is a rational multiple of tn : Sn = Rn tn . Using this, (30) yields a recurrence for the unknown rational function Rn , rn Rn+1 ? Rn = 1: (31) By Theorem 2.4, equation (31) is equivalent to r ER ? R = 1; (32) where r and R are -isomorphic images of rn and Rn . Next we show how to nd rational solutions R of equation (32). The following theorem provides a multiple of the denominator and a divisor of the numerator of R. The missing factor in the numerator can then be found using algorithm m&m-Poly of Section 4. De nition 6.1 Let r 2 F (x; y) n f0g be a non-zero rational function, and (a; b; c) = C:f :(r). For 1 i m de ne exponents ei (r) as follows: If i (a)i (b) 6= 0, let (ai; bi ; ci ) = C:f :(i (b)=i (a)). If there are v; w 2 M such that v ? w and ai =bi = v(q)=w(q), then ei (r) = degyi w. If not, or if i (a)i (b) = 0, then ei (r) = 0. Theorem 6.2 Let R = f=(ug) be a rational solution of (32) with f; g 2 F [x; y], u 2 M, g ? M, and f ? ug. Then 1. g j c where (a; b; c) = C:f :(r), 2. degyi u ei (r), 3. E?1 b j f .
Proof:
1. From (32),
r = RE+R1 = (f + Eugf)u(q) Egg : (33) On the other hand, (a; b; c) = C:f :(r), so (34) r = ab Ecc : As Ef ? Eg, g ? (f + ug)u(q), g ? M, and a ? Ek b for all k 2 N 0 , it follows by Lemma 5.3 that g divides c. 2. Write F = fc=g 2 F [x; y]. Then R = f=(ug) = F=(uc). Combining this with (33) and (34), we nd that (F + uc) u(q) b = a EF: (35) Now assume that yi j u. Then setting yi 0 in Eqn. (35) and rearranging yields i (a) Ei (F ) ? u(q) i (b) i (F ) = 0: (36) Because F j fc, f ? u and c ? M, it follows that yi 6 j F and i (F ) 6= 0. If yi j a then from (35), yi j b F . But yi 6 j b because a ? b, so yi j F . This contradiction shows that i (a) 6= 0. In an analogous way we conclude that i (b) 6= 0. Let (ai ; bi ; ci ) = C:f :(i (b)=i (a)). Then ((u(q) ai ; bi ; ci ) = C:f :(u(q) i (b)=i (a)). Since equation (36) has a non-zero polynomial solution i (F ), it follows by Theorem 5.6 that there is u1 2 M such that u(q) ai =bi = u1 (q), and that i (F ) = u1 ci for some 2 F . Then ai =bi = u1 (q)=u(q) is a quotient of two monomials. Write u1 = v t and u = w t where t; v; w 2 M and v ? w. By De niton 6.1, ei (r) = degyi w. As t j u1 j i (F ) it follows that t ? yi , so degyi u = degyi w = ei (r): We have shown that degyi u is either 0 or ei (r), so in either case degyi u ei (r). 3. From (35) it follows that b j a EF . As a ? b, we have that b j EF j Ef Ec. But b ? Ec, so E?1 b j f .
11
From Theorem 6.2 it follows that we can look for R in the form ?1 R = E u bc p (37) Q where (a; b; c) = C:f :(r) and u = mi=1 yiei (r) are known while p 2 F [x; y] is an unknown polynomial. Inserting (37) and (34) into (32) yields a Ep ? u(q) E?1 b p = u(q)u c; (38) an inhomogeneous rst-order linear recurrence relation with polynomial coecients satis ed by p. Algorithm m&m-Poly of Section 4 can now be applied to nd a polynomial solution p of Eqn. (38). The full algorithm is given in appendix C. Example 6.1 For a simple mixed example, consider the sum
Sn = Qn
n?1 X k=0
(1 ? qk+1 (k + 1))(q; q)k
(1 ? qi ).
where (q; q)n = i=1 Following algorithm m&m-Gosper we have tn = (1 ? qn+1 (n + 1))(q; q)n and, taking q1 = q and y1 = y, 2 r = (tn+1 =tn ) = (1 ? qy) 11??qq((xx++1)2)yy : The canonical form of r is (a; b; c) = (1 ? qy; 1; (1 + x)y ? 1=q) and u = 1. The recurrence to be checked for polynomial solutions, (1 ? qy)Ep ? p = (1 + x)y ? 1=q is satis ed by p = ?x=q, so R = x=(1 ? qy(x + 1)) and we nd that Sn+1 ? Sn = tn is satis ed by Sn = n(q; q)n + C . Here C is an additive constant which, for our initial sum, equals S0 = 0.
Example 6.2 For a multibasic example, we refer to the inde nite summation formula (too big to be
reproduced here) proved in [14]. The formula contains an arbitrary number, k, of bases. Such formul cannot be proved by our algorithm. However, any specialization of this formula in which k is replaced by a speci c natural number (such as 2 or 113), can be, at least in principle, not only proved, but also derived by m&m-Gosper. In [14], it is shown that several known basic and bibasic summation formul can be obtained as specializations of this k-basic master formula.
7 Concluding remarks
We have shown how to compute the hypergeometric canonical form of rational functions, how to nd polynomial solutions of recurrences, and how to perform Gosper's algorithm, all in the multibasic and mixed case. With polynomial solutions, the usual approach { obtain a degree bound and then use undetermined coecients { does not work because in the multivariate case, there may be in nitely many terms below a given one in the admissible term order. Our algorithm m&m-Poly works instead term-byterm, which guarantees termination because an admissible term order is also a well-order. In solving Gosper's equation (32), the hard part is obtaining the monomial factor in the denominator. It turns out that the degree of this factor in each variable can be found by projecting along that variable and using Theorem 5.6 on polynomial solutions of homogeneous rst-order equations. What remains to be done on the theoretical plane is to generalize the important concept of greatest factorial factorization of polynomials [10] which seems to play a fundamental role in symbolic summation, from the basic [11] and bibasic [13] cases to the multibasic and mixed one. On the algorithmic plane, multibasic and mixed generalizations of algorithms for nding rational [1] and hypergeometric [12, 3] solutions of recurrences, and also of algorithms for factorization of recurrence operators [5] should be developed.
12
A Algorithm m&m-Poly p ; : : : ; p ; g; h ; : : : ; h 2 F [x; y], p0 ; p s6= 0 P (f; ) 2 F [x; y] F of Lf = g + sj=1 j hj
INPUT: 0 1 s OUTPUT: general solution EXTERNAL ALGORITHMS USED: Poly
where
L = Pi pi Ei =0
(e; t; ) returns general solution (t; ) of the parametric inhomogeneous ordinary recurrence e (see [2]) LinSolve(e; x; ) returns general solution of the linear algebraic equations resulting from equating the coecients of like powers of x on both sides of the polynomial equation e
:= max0i degy pi pi; (x) := [y ] pi d := max0i degx pi; (x) pi;;d :=P [xd] pi; (x) P (x) := i=0mpi;;d xi R := f 2 P N 0 ; P (q ) = 0g rhs := g + sj=1 j hj f := 0 while R = 6 ; or rhs =6 0 do if R = 6 ; then := max R else := ? if rhs = 6 0 then := degy rhs else := ? if + then ' := P (t0 ; 0 ) := Poly( i=0 pi; (x)qi' t(x + i) = 0; t; ) f := f + t0 y' rhs := rhsj 0 ? L (t0 y' ) R := R n f'g end else if
then ' := ? P (t0 ; 0 ) := Poly( i=0 pi; (x)qi' t(x + i) = [y ] rhs; t; ) f := f + t0 y' rhs := rhsj 0 ? L (t0 y' ) if ' = then R := R n f'g
end else
end end return
0 := LinSolve([y ] rhs = 0; x; ) rhs := rhsj 0
f.
NB: If either Poly or LinSolve fails then m&m-Poly fails as well.
B Algorithm CanonicalForm r 2 (x; y) n f0g
INPUT: F OUTPUT: canonical form of EXTERNAL ALGORITHMS USED: Resultant GCD
r
(a; b; x) returns the resultant of polynomials a; b wrt. x (a; b) returns the mixed monic gcd of polynomials a; b
let r = (u=v ) (a0 =b0 ) where a0 b0 ? M, a0 u ? b0 v , u; v 2 M, P (; ) := Resultant(a(x; y); b(x + ; y); x) for i = 1; : : : ; m do P (; ) := P (; )Resultant(a(x; y); b(x + ; y); yi )
13
and
b0
is mixed monic
end let
h1 < h2 < < hN be the c0 := 1 for i = 1; : : : ; N do si := GCD(ai?1 ; Ehi bi?1 ) ai := ai?1 =si bi := bi?1 =QE?hi si i E?j si ci := ci?1 hj=1
roots
h 2 N0
of
p(h) = P (h; qh )
end
a := u aN b := v bN c := cN return (a; b; c).
C Algorithm m&m-Gosper INPUT: mmHS OUTPUT: mmHS
tn Sn
such that
r := (tn+1 =tn ) (see theorem (a; b; c) := CanonicalForm(r) u := 1 for i = 1 to m do if i (ab) = 0
Sn+1 ? Sn = tn ,
if it exists
2.4)
then
ei := 0
else
(ai; bi ; ci ) := CanonicalForm(i (b=a)) 9v; w 2 M : (v ? w and ai =bi = v(q)=w(q))
if then
ei := degyi w ei := 0
else end end
u := u yiei
(p; ) := m&m-Poly(a Ep ? u(q) E?1 b p = u(q)u c; p; ) R := (p E?1 b)=(u c) return ?1 (R) tn . NB: If m&m-Poly fails then m&m-Gosper fails as well.
References
[1] S. A. Abramov, Rational solutions of linear dierence and q-dierence equations with polynomial coecients, Programming and Computer Software 21 (1995) 273-278. [2] S. A. Abramov, M. Bronstein and M. Petkovsek, On polynomial solutions of linear operator equations, in: T. Levelt, ed., Proc. ISSAC '95 (ACM Press, New York, 1995) 290{296. [3] S. A. Abramov, P. Paule, M. Petkovsek, q-hypergeometric solutions of q-dierence equations, Discrete Math., to appear. [4] G. Almkvist and D. Zeilberger, The method of dierentiating under the integral sign, J. Symb. Comp. 10 (1990) 571{591. [5] M. Bronstein, M. Petkovsek, An introduction to pseudo-linear algebra, Theor. Comp. Sci. 157 (1996) 3{33.
14
[6] R.M. Cohn, Dierence Algebra, Interscience Publishers, New York, 1965. [7] R. W. Gosper, Jr., Inde nite hypergeometric sums in MACSYMA, in: Proc. MACSYMA Users Conference, Berkeley CA, 1977, 237{252. [8] R. W. Gosper, Jr., Decision procedure for inde nite hypergeometric summation, Proc. Natl. Acad. Sci. USA 75 (1978) 40{42. [9] B. Mishra, Algorithmic Algebra, Springer-Verlag, New York 1993. [10] P. Paule, Greatest factorial factorization and symbolic summation, J. Symb. Comp. 20 (1995) 235{ 268. [11] P. Paule and V. Strehl, Symbolic summation { some recent developments, in: Computer Algebra in Science and Engineering - Algorithms, Systems, and Applications, J. Fleischer, J. Grabmeier, F. Hehl, W. Kuchlin (eds.), World Scienti c, Singapore 1995, 138{162. [12] M. Petkovsek, Hypergeometric solutions of linear recurrences with polynomial coef cients, J. Symb. Comp. 14 (1992) 243{264. [13] A. Riese, A generalization of Gosper's algorithm to bibasic hypergeometric summation, Electr. J. Comb. 3 (1996) #R19. [14] U. B. Singh, Some summation formula for multibasic hypergeometric series, Glasnik Mat. 31(51) (1996) 263{268. [15] H. S. Wilf and D. Zeilberger, An algorithmic proof theory for hypergeometric (ordinary and \q") multisum/integral identities, Invent. Math. 108 (1992) 575{633. [16] D. Zeilberger, q-analog of Gosper's algorithm, unpublished manuscript, 1990. [17] D. Zeilberger, A fast algorithm for proving terminating hypergeometric identities, Discrete Math. 80 (1990) 207{211. [18] D. Zeilberger, The method of creative telescoping, J. Symb. Comput. 11 (1991) 195{204.
15