Manuel Kauers Hagenberg, January 12, 2004 RISC-Linz

Analytic Combinatorics

Lecture Notes January 13th, 2004

Interlude: An Automatic Zero Equivalence Test

1. Some classes of sequences:

(a) f(n + 3) = f(n + 1) − 3f(n): C-finite sequences (trivial)

(b) f(n + 2) = (n + 3)f(n + 1) − 3nf(n): P-finite sequences (routine)

(c) f(n+2) = H(n+3)f(n+1)−3^{n}f(n): ΠΣ-sequences (Carsten Schneider)

(d) f(n + 2) = H(n + 3)f(n + 1)^{2} − 3^{n}f(n): nonlinear recurrences (MK)

2. The larger the class, the less can be done automatically with it.

3. Consider the class C, defined by structural induction:

(a) Constant sequences belong to C

(b) if p is a polynomial in f(n), f(n + 1),…, f(n + r − 1) and f_{i}(n + j) (i = 1, …, s, j = 0, …, r, f_{i} ∈ C), then sequences defined by f(n+r) = p or f(n + r) = 1/p also belong to C.

4. Examples:

(a) all P-finite sequences

(b) Fib(n), 2^{Fib(n)}, Fib(2^{n}) ∈ C (why?)

(c) f(n) ∈ C ⟹ ∑_{k=1}^{n} f(k), ∏_{k=1}^{n} f(k) ∈ C

(d) continued fractions, orthogonal polynomials, Sylvester sequences, etc.

5. There is an algorithm which decides if a given element of C is equivalent to zero. (By A = B ⟺ A − B = 0 this allows to prove identities, note A, B ∈ C ⟹ A − B ∈ C)

6. Idea: Use polynomial ideal arithmetic.

(a) Consider f(n), f(n + 1), … as variables in a polynomial ring.

(b) Consider the ideal I generated by the recurrences.

(c) Decide f(n + r) ∈ I + ⟨f(n), …, f(n + r − 1)⟩. If yes: induction proof, otherwise increase r and try again.

7. Example: Prove ∑_{k=1}^{n} k = \frac{1}{2}n^{2} + \frac{1}{2}n

(a) Let f_{1}(n) = n, f_{2}(n) = ∑_{k=1}^{n} f_{1}(k), f_{3}(n) = f_{2}(n) − \frac{1}{2}f_{1}(n)^{2} − \frac{1}{2}f_{1}(n).

(b) Consider

I = ⟨f_{1}(n + 1) − f_{1}(n) − 1,
f_{2}(n + 1) − f_{2}(n) − f_{1}(n + 1),
f_{3}(n) − f_{2}(n) + \frac{1}{2}f_{1}(n)^{2} − \frac{1}{2}f_{1}(n)⟩

(c) We have f_{3}(n + 1) ∈ I + ⟨f_{3}(n)⟩, therefore the claim holds iff it holds for n = 1.

III Symbolic Summation

Hypergeometric Sequences

Let 𝕂 be a field of characteristic zero. Def. A sequence (f_{k})_{k≥0} in 𝕂 is called hypergeometric if there exists an r ∈ 𝕂(x) such that \frac{f_{k+1}}{f_{k}} = r(k) for all k.

Example The following sequences are easily seen to be hypergeometric. • polynomials and rational functions

• f_{k} = \frac{(−1)^{k}(2k + 1)}{k(k + 1)}

• f_{k} = q^{k} for q ∈ 𝕂 fixed

• f_{k} = (−1)^{k}\binom{a}{k} for a ∈ 𝕂 fixed, because

\frac{f_{k+1}}{f_{k}} = (−1)\begin{matrix}( & {a \atop k+1} & ) \\ ( & {a \atop k} & ) \end{matrix} = (−1)\frac{a(a − 1) ⋯ (a − k)}{(k + 1)!} \frac{k!}{a(a − 1) ⋯ (a − k + 1)}

= (−1)\frac{a − k}{k + 1} = \frac{k − a}{k + 1}

• etc.

Gosper’s Algorithm

Gosper proposed the following algorithm for indefinite hypergeometric summation in 1979. Input (f_{k})_{k≥0} hypergeometric in 𝕂. Output (g_{k})_{k≥0} hypergeometric in 𝕂 solving the telescoping equation

g_{k+1} − g_{k} = f_{k}  (T)

or IMPOSSIBLE if no such (g_{k}) exists.

0. Compute f_{rat} ∈ 𝕂(x) such that \frac{f_{k+1}}{f_{k}} = f_{rat}(k).

1. Compute the G-form of f_{rat}:

f_{rat}(x) = \frac{p(x + 1)}{p(x)} · \frac{q(x)}{r(x + 1)}

with p, q, r ∈ 𝕂[x] such that

gcd(q(x), r(x + j)) = const ≠ 0 (j ∈ ℕ)

2. Solve the Gosper equation

p(x) = q(x)y(x + 1) − r(x)y(x)  (G)

for a polynomial y(x). If no solution exists, return IMPOSSIBLE.

3. Let g_{rat}(x) = \frac{y(x + 1)}{y(x)} \frac{q(x)}{r(x)}

4. Return g_{k} := \frac{1}{g_{rat}(k) − 1}f_{k}.

Remarks • Gosper’s Algorithm solves the summation problem by ∑_{k=0}^{n} f_{k} = g_{n+1} − g_{0}.

• Correctness I: If there is no polynomial solution to (G), then there is no hypergeometric solution to (T). Proof: HW (nontrivial)

• Correctness II: g_{k} really solves (T), because

\frac{g_{k+1}}{g_{k}} HW = g_{rat}(k)

and therefore

g_{k+1} − g_{k} = g_{rat}g_{k} − g_{k} = (g_{rat} − 1)\frac{1}{g_{rat} − 1}f_{k} = f_{k}.

• The G-form is not unique. Example: \frac{p(x + 1)}{p(x)} \frac{x}{1} is a G-form for the same

rational function as \frac{p(x + 1)(x + 3)}{p(x)(x + 2)} \frac{x(x + 2)}{x + 3}.

• The G-form can be made unique by imposing the additional conditions gcd(p(x), q(x)) = 1 and gcd(p(x), r(x)) = 1.

• Step 2 can be done by means of the methods presented in Chapter I (recurrences).

Example

What is ∑_{k=0}^{n} kk! ? We apply Gosper’s algorithm.

0. \frac{f_{k+1}}{f_{k}} = \frac{(k + 1)(k + 1)!}{kk!} ⟹ f_{rat}(x) = \frac{(x + 1)^{2}}{x}

1. By inspection:

f_{rat}(x) = \frac{p(x + 1)}{p(x)} \frac{q(x)}{r(x + 1)} = \frac{x + 1}{x} · \frac{x + 1}{1}

i.e. p(x) = x, q(x) = x + 1, r(x) = 1.

2. Solve the Gosper equation

x = (x + 1)y(x + 1) − y(x)

for a polynomial y(x) ∈ 𝕂[x]. Solution: y(x) = 1.

3. g_{rat}(x) = \frac{1}{1} · \frac{x + 1}{1} = x + 1

4. g_{k} = \frac{1}{(k + 1) − 1}f_{k} = \frac{1}{k} kk! = k! (k ≥ 0)

(Check: g_{k+1} − g_{k} = (k + 1)! − k! = (k + 1 − 1)k! = kk!, OK) It follows that ∑_{k=0}^{n} kk! = (n + 1)! − 0! = (n + 1)! − 1.

HW Homework Use Gosper’s Algorithm to evaluate the following sums:

a) ∑_{k=0}^{n} q^{k} (q ∈ ℂ fixed)

b) ∑_{k=0}^{n}(−1)^{k}\binom{a}{k} (a ∈ ℂ fixed)

c) ∑_{k=1}^{n}(−1)^{k} \frac{k}{4k^{2} − 1}_{d) ∑_{k=1}^{n} \frac{1}{4k^{2} − 1}}

HW Homework Use Gosper’s Algorithm to prove that the sequence H_{n} of harmonic numbers (H_{n} = ∑_{k=1}^{n} 1/k) is not hypergeometric (and hence, in particular, not rational).

Computation of a Gosper Form

Goal: Given a rational function r(x) ∈ 𝕂(x), find a representation

r(x) = \frac{p(x + 1)}{p(x)} · \frac{q(x)}{r(x + 1)}

with p, q, r ∈ 𝕂[x] such that

gcd(q(x), r(x + j)) = const ≠ 0  (j ∈ ℕ)  (∗)

Remark If we somehow only get to a representation f_{rat}(x) = \frac{p(x + 2)}{p(x)} · \frac{q(x)}{r(x + 1)} with q, r satisfying (∗), that’s already fine, because then

f_{rat}(x) = \frac{p(x + 2)p(x + 1)}{p(x + 1)p(x)} · \frac{q(x)}{r(x + 1)}

is of the required form, and similarly for other integers in place of 2.

In order to compute a Gosper Form of f_{rat}(x) = \frac{s(x)}{t(x)}, start with p(x) = 1 and q(x) = s(x), r(x + 1) = t(x), and proceed as follows.

1. Find all j ≥ 2 such that gcd(q(x), r(x + j)) ≠ const.

Consider Res_{x}(q(x), r(x + j)). (This is a polynomial in j.) Recall that the resultant vanishes if and only if the gcd of the arguments is nontrivial. Ergo: Integer roots of the resultant give the critical j.

2. If no such j exists, we are done. Otherwise, take the smallest. Let d(x) = gcd(q(x), r(x + j)), q(x) = q̄(x)d(x), r(x + j) = r̄(x + j)d(x). Then

\frac{q(x)}{r(x + 1)} = \frac{q̄(x)}{r̄(x + 1)} · \frac{d(x)}{d(x − j + 1)}

with gcd(q̄(x), r̄(x + l)) = 1 for l ≤ j.

Update q(x) = q̄(x), r(x+1) = r̄(x+1), p(x) = p(x)d(x−1)d(x) ⋯ d(x−j+1).

3. Goto 1.

Example Let q(x) = x^{2} + x and r(x) = 2x. Then r(x + j) = 2x + 2j and

Res_{x}(q(x), r(x + j)) = |\begin{matrix}1 & 2 & 0 \\ 1 & 2j & 2 \\ 0 & 0 & 2j \end{matrix}| = 2j(2j − 2)

vanishes iff j = 0 or j = 1. j = 0 is not of interest because 0 ∉ ℕ. Take j = 1. Then gcd(q(x), r(x + 1)) = x + 1, and so we continue with

q(x) = x, r(x) = 2, p(x) = x.

Done.