The subresultant PRS algorithm computes the subresultant chain full
This proof shows: correctness.
Setting. R is an integral domain with fraction field F; f,g∈R[x] with degf=m≥degg=n≥1. S0,…,Sn−1 are the subresultants as defined on the page, sj is the coefficient of xj in Sj, and Sn=LC(g)m−n−1g∈F[x], with sn=LC(g)m−n. Each Sj with j<n lies in R[x], because its coefficients are determinants of matrices with entries in R.
Theorem (structure of the subresultant chain). This is the fundamental theorem of Brown and Traub (1971), in the form of von zur Gathen and Gerhard, Section 11.2, and of Ducos (2000); we use it without proof.
- (T0) Sn−1=prem(f,g)/(−1)m−n+1.
- (T1) Let j<n, let Sj+1 be regular (degSj+1=j+1), and let Sj=0 have degree d≤j. Then Sk=0 for d<k<j and Sd=(LC(Sj)/sj+1)j−dSj; in particular Sd is regular.
- (T2) In the situation of (T1), if d≥1, then Sd−1=prem(Sj+1,Sj)/(−sj+1)j−d+2.
- (T3) If Sj+1 is regular and Sj=0, then Sk=0 for all k<j.
Lemma 1. For λ∈F∗, prem(λB,C)=λprem(B,C). Proof. prem(B,C)=LC(C)e(BmodC) in F[x] with e=degB−degC+1, and (λB)modC=λ(BmodC). □
Invariant. At the start of each pass (line L5), with b=degB:
- B=0, Sb is regular, B=μSb for some μ∈F∗, and s=sb;
- A is the member before B, and β=−LC(A)⋅(−sa)a−b on every pass but the first, where a=degA and sa is the principal coefficient of the regular Sa (on the first pass, β=(−1)m−n+1);
- the entries Sk for k≥b that the algorithm stores are correct, and the stored entries for k<b are still 0.
Start. A=f, B=g, b=n, Sn=LC(g)m−n−1g is regular with sn=LC(g)m−n, as on line L3, and B=LC(g)−(m−n−1)Sn. Line L4 sets β as in part 2. No entry is stored yet.
One pass. Let j=b−1. Line L6 computes C=prem(A,B)/β.
On the first pass, C=Sn−1 by (T0). On a later pass, A=νSa for some ν∈F∗ by part 1 of the invariant from the previous pass, and the previous pass had C=B equal to the subresultant Sa−1, of degree b, with Sb regular by (T1). By (T2) applied with j+1=a and Sj=Sa−1 of degree b, Sb−1=prem(Sa,Sa−1)/(−sa)a−b+1. By Lemma 1 and Sa=A/ν, with LC(A)=νsa:
Sb−1=ν(−sa)a−b+1prem(A,B)=−LC(A)(−sa)a−bprem(A,B)=βprem(A,B). So in every pass C=Sb−1=Sj, and C∈R[x], so the division on line L6 is exact.
If C=0, then Sj=0, and by (T3) all Sk with k<j are zero, as stored. The algorithm returns at line L7 with the chain complete.
Otherwise line L8 stores Sj=C. Let d=degC and e=b−d≥1. By (T1), with Sj+1=Sb regular, Sk=0 for d<k<j, which are still 0 as stored, and Sd=(LC(C)/sb)j−dC=LC(C)e−1C/se−1. If e=1, then d=j and this is C itself; if e≥2, line L9 stores it. In both cases Sd is regular and lies in R[x], so the division on line L9 is exact. If d=0, all entries are now stored and the algorithm returns at line L10.
If d≥1, line L11 sets β=−LC(B)(−sb)b−d, line L12 sets s=sd, and line L13 shifts the pair to (B,C). Now C=Sj is a nonzero multiple of the regular Sd, by (T1). So the invariant holds for the next pass, with a replaced by b and b by d.
Termination. degB falls strictly in each pass, so the loop ends after at most n passes, at line L7 or L10.
The gcd. Over F, prem(A,B) is a nonzero constant times AmodB, and so is C. So the pairs (A,B) follow the Euclidean algorithm over F up to constant factors, and they keep the set of common divisors in F[x]. At line L7, B divides A in F[x], so B is an associate of gcd(f,g) over F. At line L10, C is a nonzero constant, so gcd(f,g)=1 over F. By Gauss's lemma, gcd(contf,contg)⋅pp(B) is the gcd in Z[x] in the first case, and the content gcd alone in the second. ■