Algorithm Search⌘K

Proofs: Fast polynomial interpolation

These are the human proofs of Fast polynomial interpolation, at full length.

FAST-INTERPOLATE returns the interpolating polynomial in O(M(n) log n) operations full

This proof shows: correctness.

Let RR be a commutative ring with 11, n≥1n \ge 1, u0,…,un−1∈Ru_0, \ldots, u_{n-1} \in R with ui−uju_i - u_j a unit for all i≠ji \ne j, and v0,…,vn−1∈Rv_0, \ldots, v_{n-1} \in R. Let m=∏i(x−ui)m = \prod_i (x - u_i) and, for a node (j,k)(j, k) of the subproduct tree, let Sj,kS_{j,k} be the set of leaves below it, so that mj,k=∏i∈Sj,k(x−ui)m_{j,k} = \prod_{i \in S_{j,k}} (x - u_i). 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 ii, m′(ui)=∏j≠i(ui−uj)m'(u_i) = \prod_{j \ne i} (u_i - u_j), which is a unit.

Proof. Write m=(x−ui)qim = (x - u_i) q_i with qi=∏j≠i(x−uj)q_i = \prod_{j \ne i} (x - u_j). The product rule for formal derivatives gives m′=qi+(x−ui)qi′m' = q_i + (x - u_i) q_i', so m′(ui)=qi(ui)m'(u_i) = q_i(u_i). A product of units is a unit. □\square

Lemma 2 (Lagrange's formula). The polynomial f=∑ici qif = \sum_i c_i\, q_i with ci=vi m′(ui)−1c_i = v_i\, m'(u_i)^{-1} has degree less than nn and satisfies f(ui)=vif(u_i) = v_i for all ii, and it is the only polynomial with these two properties.

Proof. Each qiq_i has degree n−1n - 1, so deg⁡f<n\deg f < n. For j≠ij \ne i, qi(uj)=0q_i(u_j) = 0, because x−ujx - u_j is a factor of qiq_i. So f(ui)=ciqi(ui)=vim′(ui)−1m′(ui)=vif(u_i) = c_i q_i(u_i) = v_i m'(u_i)^{-1} m'(u_i) = v_i by Lemma 1. For uniqueness, let gg have the same properties and d=f−gd = f - g. Then d(u0)=0d(u_0) = 0, so d=(x−u0)d1d = (x - u_0) d_1 by the factor theorem. Since d(u1)=(u1−u0)d1(u1)=0d(u_1) = (u_1 - u_0) d_1(u_1) = 0 and u1−u0u_1 - u_0 is a unit, d1(u1)=0d_1(u_1) = 0. Repeating, mm divides dd. As mm is monic of degree n>deg⁡dn > \deg d, d=0d = 0. □\square

Lemma 3 (the upward pass). LINEAR-COMBINATION(c,tree)(c, \text{tree}) computes, for every node, rj,k=∑i∈Sj,kci mj,k/(x−ui)r_{j,k} = \sum_{i \in S_{j,k}} c_i\, m_{j,k}/(x - u_i), where each quotient mj,k/(x−ui)m_{j,k}/(x - u_i) is the exact product ∏l∈Sj,k,l≠i(x−ul)\prod_{l \in S_{j,k}, l \ne i} (x - u_l).

Proof. By induction on jj. At level 00, S0,i={i}S_{0,i} = \{i\} and m0,i/(x−ui)=1m_{0,i}/(x - u_i) = 1, so r0,i=cir_{0,i} = c_i, which is line C1. Let j≥1j \ge 1. If node kk of level jj is a copy of node 2k2k of level j−1j - 1, then Sj,k=Sj−1,2kS_{j,k} = S_{j-1,2k}, mj,k=mj−1,2km_{j,k} = m_{j-1,2k}, and line C6 keeps the value, which is correct. Otherwise let L=Sj−1,2kL = S_{j-1,2k}, Q=Sj−1,2k+1Q = S_{j-1,2k+1}, mL=mj−1,2km_L = m_{j-1,2k} and mQ=mj−1,2k+1m_Q = m_{j-1,2k+1}. Then Sj,k=L∪QS_{j,k} = L \cup Q, disjoint, and mj,k=mLmQm_{j,k} = m_L m_Q. For i∈Li \in L, mj,k/(x−ui)=mQ⋅mL/(x−ui)m_{j,k}/(x - u_i) = m_Q \cdot m_L/(x - u_i), and for i∈Qi \in Q, mj,k/(x−ui)=mL⋅mQ/(x−ui)m_{j,k}/(x - u_i) = m_L \cdot m_Q/(x - u_i). Hence

∑i∈L∪Qcimj,kx−ui=mQ∑i∈LcimLx−ui+mL∑i∈QcimQx−ui=mQ rj−1,2k+mL rj−1,2k+1,\sum_{i \in L \cup Q} c_i \frac{m_{j,k}}{x - u_i} = m_Q \sum_{i \in L} c_i \frac{m_L}{x - u_i} + m_L \sum_{i \in Q} c_i \frac{m_Q}{x - u_i} = m_Q\, r_{j-1,2k} + m_L\, r_{j-1,2k+1},

by the induction hypothesis, which is line C5. □\square

Theorem (correctness). FAST-INTERPOLATE returns the unique ff with deg⁡f<n\deg f < n and f(ui)=vif(u_i) = v_i for all ii.

Proof. For n=0n = 0 the zero polynomial is the unique polynomial of degree less than 00, and line L1 returns it. Let n≥1n \ge 1. Line L3 computes si=m′(ui)s_i = m'(u_i) for all ii, by the correctness theorem of fast multipoint evaluation, which applies to any polynomial and any points on the same tree. By Lemma 1 each sis_i is a unit, so line L4 computes ci=vim′(ui)−1c_i = v_i m'(u_i)^{-1}. By Lemma 3 at the root, line L5 returns ∑ici m/(x−ui)=∑iciqi\sum_i c_i\, m/(x - u_i) = \sum_i c_i q_i, which is the unique interpolant by Lemma 2. □\square

Theorem (cost). Assume that multiplying a polynomial with aa coefficients by one with at most aa coefficients costs at most M(a)M(a) ring operations, that M(a)/aM(a)/a is nondecreasing, and that M(2a)≤4M(a)M(2a) \le 4M(a). Then FAST-INTERPOLATE uses at most 19M(n)⌈log⁡2n⌉+O(nlog⁡n)19 M(n) \lceil \log_2 n \rceil + O(n \log n) ring operations and nn inversions in RR.

Proof. As in the proof for fast multipoint evaluation, MM is nondecreasing and superadditive. The tree costs at most 4M(n)4M(n) per level. The derivative m′m' costs O(n)O(n), and since deg⁡m′<n\deg m' < n, its evaluation on the tree costs at most 7M(n)+O(n)7M(n) + O(n) per level, by the cost theorem for fast multipoint evaluation. Line L4 costs nn inversions and nn multiplications. In the upward pass, a node of level jj that is a product of children of degrees d1d_1 and d2d_2, with D=d1+d2D = d_1 + d_2, does two products in line C5. By Lemma 3, rj−1,2kr_{j-1,2k} has degree less than d1d_1 and mQm_Q has d2+1d_2 + 1 coefficients, so this product costs at most M(D+1)M(D + 1), and the same holds for the other product. The addition costs O(D)O(D). A level has at most nn nodes and the degrees sum to nn, so ∑(D+1)≤2n\sum (D + 1) \le 2n and the level costs at most 2M(2n)+O(n)≤8M(n)+O(n)2M(2n) + O(n) \le 8M(n) + O(n). Adding 4M(n)+7M(n)+8M(n)+O(n)4M(n) + 7M(n) + 8M(n) + O(n) over ⌈log⁡2n⌉\lceil \log_2 n \rceil levels gives the bound. ■\blacksquare

Back to Fast polynomial interpolation