Algorithm Search⌘K

Proofs: Rothstein-Trager algorithm

These are the human proofs of Rothstein-Trager algorithm, at full length.

The Rothstein-Trager algorithm returns the logarithmic part of the integral full

This proof shows: correctness.

Setting. KK is a field of characteristic 00 with algebraic closure K‾\overline{K}. A,D∈K[x]A, D \in K[x], DD squarefree, n=deg⁡D≥1n = \deg D \ge 1, deg⁡A<n\deg A < n. α1,…,αn∈K‾\alpha_1, \ldots, \alpha_n \in \overline{K} are the roots of DD, which are distinct, so D′(αj)≠0D'(\alpha_j) \ne 0. The residue at αj\alpha_j is rj=A(αj)/D′(αj)r_j = A(\alpha_j)/D'(\alpha_j). R(z)=res⁡x(D,A−zD′)R(z) = \operatorname{res}_x(D, A - z D'), with the Sylvester matrix of formal degrees nn and n−1n - 1. All gcds are monic. log⁡\log is a formal symbol with (log⁡v)′=v′/v(\log v)' = v'/v, and equalities of integrals are equalities of derivatives.

Lemma 1 (the resultant). R(z)=LC⁡(D)n−1∏j=1n(A(αj)−zD′(αj))R(z) = \operatorname{LC}(D)^{n-1} \prod_{j=1}^n \big(A(\alpha_j) - z D'(\alpha_j)\big). So RR has degree exactly nn, and its roots are r1,…,rnr_1, \ldots, r_n, with multiplicity.

Proof. For ff of degree nn with leading coefficient aa and roots αj\alpha_j, and any gg of formal degree kk, the Sylvester determinant of formal degrees nn and kk is ak∏jg(αj)a^k \prod_j g(\alpha_j); this is the product formula on the resultant page, and it holds for every gg of degree at most kk, because both sides are polynomials in the coefficients of gg. Apply it in K[z]K[z] with f=Df = D and g=A−zD′g = A - z D', of formal degree n−1n - 1. The factor jj is D′(αj)(rj−z)D'(\alpha_j)(r_j - z), with D′(αj)≠0D'(\alpha_j) \ne 0. So R(z)=LC⁡(D)n−1∏jD′(αj)⋅∏j(rj−z)R(z) = \operatorname{LC}(D)^{n-1} \prod_j D'(\alpha_j) \cdot \prod_j (r_j - z), with a nonzero constant in front. □\square

Lemma 2 (the gcds). For c∈K‾c \in \overline{K}, gcd⁡(D,A−cD′)=∏j:rj=c(x−αj)\gcd(D, A - c D') = \prod_{j : r_j = c} (x - \alpha_j) in K‾[x]\overline{K}[x]. If c∈Kc \in K, this gcd lies in K[x]K[x].

Proof. DD is squarefree, so its monic divisors in K‾[x]\overline{K}[x] are the products of distinct x−αjx - \alpha_j, and gcd⁡(D,G)\gcd(D, G) is the product over the roots αj\alpha_j of DD with G(αj)=0G(\alpha_j) = 0. For G=A−cD′G = A - c D', G(αj)=0G(\alpha_j) = 0 exactly when A(αj)=cD′(αj)A(\alpha_j) = c D'(\alpha_j), that is rj=cr_j = c, because D′(αj)≠0D'(\alpha_j) \ne 0. If c∈Kc \in K, the Euclidean algorithm for DD and A−cD′A - c D' runs in K[x]K[x], and the monic gcd does not depend on the field. □\square

Theorem. ∫AD dx=∑cclog⁡gcd⁡(D,A−cD′)\displaystyle \int \frac{A}{D} \, dx = \sum_{c} c \log \gcd(D, A - c D'), where cc runs over the distinct nonzero roots of RR.

Proof. Since deg⁡A<n\deg A < n and the αj\alpha_j are distinct, partial fractions over K‾\overline{K} give A/D=∑jλj/(x−αj)A/D = \sum_j \lambda_j/(x - \alpha_j). Multiply by x−αjx - \alpha_j and let x→αjx \to \alpha_j: since D/(x−αj)D/(x - \alpha_j) at αj\alpha_j is D′(αj)D'(\alpha_j), λj=A(αj)/D′(αj)=rj\lambda_j = A(\alpha_j)/D'(\alpha_j) = r_j. So A/D=∑jrj/(x−αj)A/D = \sum_j r_j/(x - \alpha_j). For each distinct value cc of the residues, with Gc=∏rj=c(x−αj)G_c = \prod_{r_j = c} (x - \alpha_j), (log⁡Gc)′=∑rj=c1/(x−αj)(\log G_c)' = \sum_{r_j = c} 1/(x - \alpha_j). Hence

(∑cclog⁡Gc)′=∑c∑rj=ccx−αj=∑jrjx−αj=AD.\Big( \sum_c c \log G_c \Big)' = \sum_c \sum_{r_j = c} \frac{c}{x - \alpha_j} = \sum_j \frac{r_j}{x - \alpha_j} = \frac{A}{D}.

Terms with c=0c = 0 contribute 00 and can be dropped. By Lemma 1 the distinct values cc are the distinct roots of RR, and by Lemma 2 Gc=gcd⁡(D,A−cD′)G_c = \gcd(D, A - c D'). □\square

Lemma 3 (gcd in a product of fields). Let q∈K[z]q \in K[z] be monic and squarefree of positive degree, L=K[z]/(q)L = K[z]/(q), and F,G∈L[x]F, G \in L[x]. Suppose the Euclidean algorithm on F,GF, G in L[x]L[x], as on line L6, finds an inverse for every leading coefficient it needs, and returns the monic SS. Then for every root c∈K‾c \in \overline{K} of qq, S(c,x)=gcd⁡(F(c,x),G(c,x))S(c, x) = \gcd(F(c, x), G(c, x)).

Proof. The map ϕc:L→K‾\phi_c : L \to \overline{K}, z↦cz \mapsto c, is a well defined ring homomorphism because q(c)=0q(c) = 0; extend it to L[x]→K‾[x]L[x] \to \overline{K}[x] coefficientwise. If u∈Lu \in L has an inverse, then ϕc(u)ϕc(u−1)=1\phi_c(u)\phi_c(u^{-1}) = 1, so ϕc(u)≠0\phi_c(u) \ne 0. The algorithm removes leading coefficients that are 00 in LL, so every polynomial it keeps has an exact degree in L[x]L[x], and every one that is used as a divisor, or returned, has an invertible leading coefficient. Consider one division step a=Qb+ra = Q b + r in L[x]L[x], with LC⁡(b)\operatorname{LC}(b) invertible and deg⁡r<deg⁡b\deg r < \deg b. Then ϕc(a)=ϕc(Q)ϕc(b)+ϕc(r)\phi_c(a) = \phi_c(Q) \phi_c(b) + \phi_c(r), deg⁡ϕc(b)=deg⁡b\deg \phi_c(b) = \deg b, and deg⁡ϕc(r)≤deg⁡r<deg⁡ϕc(b)\deg \phi_c(r) \le \deg r < \deg \phi_c(b), so ϕc(r)\phi_c(r) is the remainder of ϕc(a)\phi_c(a) by ϕc(b)\phi_c(b) in K‾[x]\overline{K}[x], and gcd⁡(ϕc(a),ϕc(b))=gcd⁡(ϕc(b),ϕc(r))\gcd(\phi_c(a), \phi_c(b)) = \gcd(\phi_c(b), \phi_c(r)). By induction over the steps, gcd⁡(ϕc(F),ϕc(G))=gcd⁡(ϕc(alast),0)\gcd(\phi_c(F), \phi_c(G)) = \gcd(\phi_c(a_{\text{last}}), 0), where alasta_{\text{last}} is the last nonzero remainder. Its leading coefficient is invertible, so ϕc(alast)\phi_c(a_{\text{last}}) has the same degree and ϕc(S)=ϕc(alast)/ϕc(LC⁡(alast))\phi_c(S) = \phi_c(a_{\text{last}})/\phi_c(\operatorname{LC}(a_{\text{last}})) is its monic form. So S(c,x)=gcd⁡(F(c,x),G(c,x))S(c, x) = \gcd(F(c, x), G(c, x)). □\square

Lemma 4 (splitting). If u∈Lu \in L is nonzero (as a polynomial of degree less than deg⁡q\deg q) and has no inverse, then g=gcd⁡(u,q)g = \gcd(u, q) in K[z]K[z] has 0<deg⁡g<deg⁡q0 < \deg g < \deg q, and gg and q/gq/g are monic, squarefree and coprime, and the roots of qq are the disjoint union of the roots of gg and of q/gq/g.

Proof. uu has an inverse modulo qq exactly when gcd⁡(u,q)=1\gcd(u, q) = 1, by the extended Euclidean algorithm. So deg⁡g>0\deg g > 0. Since u≠0u \ne 0 and deg⁡u<deg⁡q\deg u < \deg q, q∤uq \nmid u, so g≠qg \ne q. A factorization of a squarefree polynomial has squarefree, coprime factors, and their roots partition the roots of qq. □\square

The algorithm. We show that the output pairs (qi,Si)(q_i, S_i) satisfy ∑i∑qi(c)=0clog⁡Si(c,x)=∫A/D dx\sum_i \sum_{q_i(c) = 0} c \log S_i(c, x) = \int A/D \, dx.

Lines L1 to L3. Line L1 computes RR. The implementation evaluates the Sylvester determinant at z=0,…,nz = 0, \ldots, n and interpolates; this is exact because deg⁡R≤n\deg R \le n by Lemma 1. For each rational root c≠0c \ne 0, line L3 outputs clog⁡gcd⁡(D,A−cD′)c \log \gcd(D, A - c D'), the term of the theorem for cc.

Line L4. Let CQC_{\mathbb{Q}} be the set of rational roots of RR. qq is the squarefree part of R/∏c∈CQ(z−c)μcR / \prod_{c \in C_{\mathbb{Q}}} (z - c)^{\mu_c}, where μc\mu_c is the multiplicity, made monic. So the roots of qq are the distinct roots of RR not in CQC_{\mathbb{Q}}, each simple, and 00 is not among them. If deg⁡q=0\deg q = 0, all terms of the theorem are already output.

Lines L5 to L8. Invariant: the roots of the polynomials on the stack and of the qiq_i already output are, together, the roots of the qq of line L4, each exactly once; each polynomial on the stack is monic and squarefree of positive degree. It holds at the start. A pass pops qq and runs the Euclidean algorithm for F=DF = D and G=A−zD′G = A - z D' in (K[z]/(q))[x](K[z]/(q))[x]. If an inverse fails at line L7, Lemma 4 shows that the two pushed factors keep the invariant. Otherwise, by Lemma 3, S(c,x)=gcd⁡(D,A−cD′)S(c, x) = \gcd(D, A - c D') for every root cc of qq, so the pair (q,S)(q, S) of line L8 stands for exactly the terms of the theorem for the roots of qq, and the invariant holds.

Termination. Each split replaces qq by two factors of smaller positive degree, so the total number of splits is less than the degree of the qq of line L4, and each pass either splits or outputs. So the loop ends, with an empty stack.

Result. When the loop ends, by the invariant every distinct nonzero root of RR is a root of exactly one output qiq_i (degree 1 for the rational ones from line L3). By Lemma 2 and Lemma 3 the term for each root cc is clog⁡gcd⁡(D,A−cD′)c \log \gcd(D, A - c D'). So the output sum is the sum of the theorem, which is ∫A/D dx\int A/D \, dx. ■\blacksquare

Back to Rothstein-Trager algorithm