FAST-INTERPOLATE returns the interpolating polynomial in O(M(n) log n) operations full
This proof shows: correctness.
Let R be a commutative ring with 1, n≥1, u0,…,un−1∈R with ui−uj a unit for all i=j, and v0,…,vn−1∈R. Let m=∏i(x−ui) and, for a node (j,k) of the subproduct tree, let Sj,k be the set of leaves below it, so that mj,k=∏i∈Sj,k(x−ui). The structure of the tree is Lemma 1 of the proof for fast multipoint evaluation: the sets of one level partition the leaves, and a node is the product of its children or a copy of its only child.
Lemma 1 (the derivative at a root). For each i, m′(ui)=∏j=i(ui−uj), which is a unit.
Proof. Write m=(x−ui)qi with qi=∏j=i(x−uj). The product rule for formal derivatives gives m′=qi+(x−ui)qi′, so m′(ui)=qi(ui). A product of units is a unit. □
Lemma 2 (Lagrange's formula). The polynomial f=∑iciqi with ci=vim′(ui)−1 has degree less than n and satisfies f(ui)=vi for all i, and it is the only polynomial with these two properties.
Proof. Each qi has degree n−1, so degf<n. For j=i, qi(uj)=0, because x−uj is a factor of qi. So f(ui)=ciqi(ui)=vim′(ui)−1m′(ui)=vi by Lemma 1. For uniqueness, let g have the same properties and d=f−g. Then d(u0)=0, so d=(x−u0)d1 by the factor theorem. Since d(u1)=(u1−u0)d1(u1)=0 and u1−u0 is a unit, d1(u1)=0. Repeating, m divides d. As m is monic of degree n>degd, d=0. □
Lemma 3 (the upward pass). LINEAR-COMBINATION(c,tree) computes, for every node, rj,k=∑i∈Sj,kcimj,k/(x−ui), where each quotient mj,k/(x−ui) is the exact product ∏l∈Sj,k,l=i(x−ul).
Proof. By induction on j. At level 0, S0,i={i} and m0,i/(x−ui)=1, so r0,i=ci, which is line C1. Let j≥1. If node k of level j is a copy of node 2k of level j−1, then Sj,k=Sj−1,2k, mj,k=mj−1,2k, and line C6 keeps the value, which is correct. Otherwise let L=Sj−1,2k, Q=Sj−1,2k+1, mL=mj−1,2k and mQ=mj−1,2k+1. Then Sj,k=L∪Q, disjoint, and mj,k=mLmQ. For i∈L, mj,k/(x−ui)=mQ⋅mL/(x−ui), and for i∈Q, mj,k/(x−ui)=mL⋅mQ/(x−ui). Hence
i∈L∪Q∑cix−uimj,k=mQi∈L∑cix−uimL+mLi∈Q∑cix−uimQ=mQrj−1,2k+mLrj−1,2k+1, by the induction hypothesis, which is line C5. □
Theorem (correctness). FAST-INTERPOLATE returns the unique f with degf<n and f(ui)=vi for all i.
Proof. For n=0 the zero polynomial is the unique polynomial of degree less than 0, and line L1 returns it. Let n≥1. Line L3 computes si=m′(ui) for all i, by the correctness theorem of fast multipoint evaluation, which applies to any polynomial and any points on the same tree. By Lemma 1 each si is a unit, so line L4 computes ci=vim′(ui)−1. By Lemma 3 at the root, line L5 returns ∑icim/(x−ui)=∑iciqi, which is the unique interpolant by Lemma 2. □
Theorem (cost). Assume that multiplying a polynomial with a coefficients by one with at most a coefficients costs at most M(a) ring operations, that M(a)/a is nondecreasing, and that M(2a)≤4M(a). Then FAST-INTERPOLATE uses at most 19M(n)⌈log2n⌉+O(nlogn) ring operations and n inversions in R.
Proof. As in the proof for fast multipoint evaluation, M is nondecreasing and superadditive. The tree costs at most 4M(n) per level. The derivative m′ costs O(n), and since degm′<n, its evaluation on the tree costs at most 7M(n)+O(n) per level, by the cost theorem for fast multipoint evaluation. Line L4 costs n inversions and n multiplications. In the upward pass, a node of level j that is a product of children of degrees d1 and d2, with D=d1+d2, does two products in line C5. By Lemma 3, rj−1,2k has degree less than d1 and mQ has d2+1 coefficients, so this product costs at most M(D+1), and the same holds for the other product. The addition costs O(D). A level has at most n nodes and the degrees sum to n, so ∑(D+1)≤2n and the level costs at most 2M(2n)+O(n)≤8M(n)+O(n). Adding 4M(n)+7M(n)+8M(n)+O(n) over ⌈log2n⌉ levels gives the bound. ■