Algorithm Search⌘K

Proofs: Point-value representation

These are the human proofs of Point-value representation, at full length.

The point-value operations, barycentric evaluation and divided differences are correct full

This proof shows: correctness.

Let FF be a field, n≥1n \ge 1, and U=(u0,…,un−1)U = (u_0, \ldots, u_{n-1}) distinct points of FF. Write PnP_n for the set of polynomials in F[x]F[x] of degree less than nn, and ev⁡U(f)=(f(u0),…,f(un−1))\operatorname{ev}_U(f) = (f(u_0), \ldots, f(u_{n-1})).

Lemma 1 (interpolation is unique and exists). The map ev⁡U:Pn→Fn\operatorname{ev}_U : P_n \to F^n is a bijection. Its inverse is given by Lagrange's formula L(y)=∑iyiℓiL(y) = \sum_i y_i \ell_i with ℓi=∏j≠i(x−uj)/(ui−uj)\ell_i = \prod_{j \ne i} (x - u_j)/(u_i - u_j).

Proof. Each ℓi\ell_i has degree n−1n - 1, and ℓi(uk)\ell_i(u_k) is 11 for k=ik = i and 00 for k≠ik \ne i, because the factor x−ukx - u_k vanishes at uku_k and the denominators are nonzero since the points are distinct. So L(y)∈PnL(y) \in P_n and ev⁡U(L(y))=y\operatorname{ev}_U(L(y)) = y; the map is onto. If f,g∈Pnf, g \in P_n have the same values, then f−g∈Pnf - g \in P_n has the nn distinct roots u0,…,un−1u_0, \ldots, u_{n-1}. By the root bound of the factor theorem, a nonzero polynomial of degree less than nn has fewer than nn roots over a field, so f−g=0f - g = 0; the map is one-to-one. □\square

Lemma 2 (ADD and MUL). Let y=ev⁡U(f)y = \operatorname{ev}_U(f) and z=ev⁡U(g)z = \operatorname{ev}_U(g) with f,g∈Pnf, g \in P_n. Then ADD(y,z)=ev⁡U(f+g)(y, z) = \operatorname{ev}_U(f + g), and if deg⁡f+deg⁡g<n\deg f + \deg g < n, MUL(y,z)=ev⁡U(fg)(y, z) = \operatorname{ev}_U(fg). Without the degree condition, MUL(y,z)=ev⁡U(fg mod m)(y, z) = \operatorname{ev}_U(fg \bmod m) with m=∏i(x−ui)m = \prod_i (x - u_i).

Proof. Evaluation at uiu_i is a ring homomorphism F[x]→FF[x] \to F, so (f+g)(ui)=f(ui)+g(ui)=yi+zi(f + g)(u_i) = f(u_i) + g(u_i) = y_i + z_i and (fg)(ui)=yizi(fg)(u_i) = y_i z_i. The sum f+gf + g is in PnP_n, so by Lemma 1 it is the polynomial that ADD(y,z)(y, z) represents. If deg⁡f+deg⁡g<n\deg f + \deg g < n then fg∈Pnfg \in P_n, and the same argument applies. In general write fg=qm+rfg = qm + r with deg⁡r<n\deg r < n. Since m(ui)=0m(u_i) = 0, r(ui)=(fg)(ui)=yizir(u_i) = (fg)(u_i) = y_i z_i, and r∈Pnr \in P_n, so MUL(y,z)(y, z) represents r=fg mod mr = fg \bmod m. □\square

Lemma 3 (EVALUATE-AT). Let wi=1/∏j≠i(ui−uj)w_i = 1/\prod_{j \ne i}(u_i - u_j), as computed by lines L1 to L3, and f=L(y)f = L(y). For every t∈Ft \in F, EVALUATE-AT(y,t)=f(t)(y, t) = f(t).

Proof. If t=ukt = u_k, line L6 returns yk=f(uk)y_k = f(u_k). Otherwise t−ui≠0t - u_i \ne 0 for each ii. Let ℓ(t)=∏j(t−uj)\ell(t) = \prod_j (t - u_j). For each ii,

ℓi(t)=∏j≠it−ujui−uj=wi∏j≠i(t−uj)=wiℓ(t)t−ui.\ell_i(t) = \prod_{j \ne i} \frac{t - u_j}{u_i - u_j} = w_i \prod_{j \ne i} (t - u_j) = w_i \frac{\ell(t)}{t - u_i}.

So f(t)=∑iyiℓi(t)=ℓ(t)∑iwiyit−uif(t) = \sum_i y_i \ell_i(t) = \ell(t) \sum_i \frac{w_i y_i}{t - u_i}, which lines L7 and L8 compute. □\square

Lemma 4 (divided differences). For 0≤j≤i≤n−10 \le j \le i \le n - 1 let pj,i∈F[x]p_{j,i} \in F[x] be the polynomial of degree at most i−ji - j with pj,i(ul)=ylp_{j,i}(u_l) = y_l for j≤l≤ij \le l \le i (it exists and is unique by Lemma 1 for the points uj,…,uiu_j, \ldots, u_i), and let f[uj,…,ui]f[u_j, \ldots, u_i] be the coefficient of xi−jx^{i-j} in it. Then f[ui]=yif[u_i] = y_i and, for j<ij < i,

f[uj,…,ui]=f[uj+1,…,ui]−f[uj,…,ui−1]ui−uj.f[u_j, \ldots, u_i] = \frac{f[u_{j+1}, \ldots, u_i] - f[u_j, \ldots, u_{i-1}]}{u_i - u_j}.

Proof. The constant yiy_i interpolates at the single point uiu_i. For j<ij < i let

q=(x−uj) pj+1,i−(x−ui) pj,i−1ui−uj.q = \frac{(x - u_j)\, p_{j+1,i} - (x - u_i)\, p_{j,i-1}}{u_i - u_j}.

Its degree is at most i−ji - j. At uju_j the first term vanishes, and q(uj)=−(uj−ui)yj/(ui−uj)=yjq(u_j) = -(u_j - u_i) y_j / (u_i - u_j) = y_j. At uiu_i the second term vanishes, and q(ui)=(ui−uj)yi/(ui−uj)=yiq(u_i) = (u_i - u_j) y_i / (u_i - u_j) = y_i. At ulu_l with j<l<ij < l < i, both pj+1,ip_{j+1,i} and pj,i−1p_{j,i-1} take the value yly_l, so q(ul)=yl ((ul−uj)−(ul−ui))/(ui−uj)=ylq(u_l) = y_l\, ((u_l - u_j) - (u_l - u_i))/(u_i - u_j) = y_l. By uniqueness, q=pj,iq = p_{j,i}. The coefficient of xi−jx^{i-j} in qq is the difference of the coefficients of xi−j−1x^{i-j-1} in pj+1,ip_{j+1,i} and pj,i−1p_{j,i-1}, divided by ui−uju_i - u_j, which is the recurrence. □\square

Lemma 5 (line L10). After round kk of line L10 (and before round 1, for k=0k = 0), d[i]=f[ui−k,…,ui]d[i] = f[u_{i-k}, \ldots, u_i] for i≥ki \ge k, and d[i]=f[u0,…,ui]d[i] = f[u_0, \ldots, u_i] for i<ki < k.

Proof. Induction on kk. For k=0k = 0, d=yd = y and f[ui]=yif[u_i] = y_i. Suppose the claim holds after round k−1k - 1. Round kk updates d[i]d[i] for i=n−1i = n - 1 down to kk, in decreasing order, so when d[i]d[i] is updated, d[i−1]d[i - 1] still holds the value from round k−1k - 1. By the hypothesis, the new value is

f[ui−k+1,…,ui]−f[ui−k,…,ui−1]ui−ui−k=f[ui−k,…,ui]\frac{f[u_{i-k+1}, \ldots, u_i] - f[u_{i-k}, \ldots, u_{i-1}]}{u_i - u_{i-k}} = f[u_{i-k}, \ldots, u_i]

by Lemma 4. The entry d[k−1]d[k - 1] is not updated in round kk and equals f[u0,…,uk−1]f[u_0, \ldots, u_{k-1}] from round k−1k - 1; the entries below it were final before. □\square

Lemma 6 (Newton form). Let dk=f[u0,…,uk]d_k = f[u_0, \ldots, u_k] and f=L(y)f = L(y). Then

f=∑k=0n−1dk∏j<k(x−uj).f = \sum_{k=0}^{n-1} d_k \prod_{j<k} (x - u_j).

Proof. Let Nk=∑l=0kdl∏j<l(x−uj)N_k = \sum_{l=0}^{k} d_l \prod_{j<l} (x - u_j). We show Nk=p0,kN_k = p_{0,k} by induction. For k=0k = 0, N0=y0=p0,0N_0 = y_0 = p_{0,0}. For k≥1k \ge 1, the polynomial p0,k−p0,k−1p_{0,k} - p_{0,k-1} has degree at most kk and vanishes at u0,…,uk−1u_0, \ldots, u_{k-1}, so by the factor theorem it equals c∏j<k(x−uj)c \prod_{j<k} (x - u_j) for a constant cc. Comparing the coefficients of xkx^k gives c=dkc = d_k, because p0,k−1p_{0,k-1} has degree less than kk. So p0,k=Nk−1+dk∏j<k(x−uj)=Nkp_{0,k} = N_{k-1} + d_k \prod_{j<k}(x - u_j) = N_k. For k=n−1k = n - 1, p0,n−1=fp_{0,n-1} = f. □\square

Lemma 7 (lines L11 to L13). Lines L11 and L12 compute ∑kdk∏j<k(x−uj)\sum_k d_k \prod_{j<k}(x - u_j), and line L13 returns its normalized coefficient list.

Proof. We claim that after the step of line L12 with index ii (and after line L11, with i=n−1i = n - 1), c=∑k=in−1dk∏j=ik−1(x−uj)c = \sum_{k=i}^{n-1} d_k \prod_{j=i}^{k-1}(x - u_j). Line L11 sets c=dn−1c = d_{n-1}, the case i=n−1i = n - 1. The step with index ii multiplies by (x−ui)(x - u_i) and adds did_i:

(∑k=i+1n−1dk∏j=i+1k−1(x−uj))(x−ui)+di=∑k=in−1dk∏j=ik−1(x−uj).\Bigl(\sum_{k=i+1}^{n-1} d_k \prod_{j=i+1}^{k-1}(x - u_j)\Bigr)(x - u_i) + d_i = \sum_{k=i}^{n-1} d_k \prod_{j=i}^{k-1}(x - u_j).

For i=0i = 0 this is the Newton form. Line L13 removes only zero top entries, which does not change the polynomial. □\square

Theorem. For distinct points UU, every list in FnF^n represents exactly one polynomial in PnP_n; ADD, MUL (under deg⁡f+deg⁡g<n\deg f + \deg g < n), EVALUATE-AT and TO-COEFFICIENTS return the representation, the value, and the normalized coefficient list of the right polynomial.

Proof. Lemma 1 gives the representation, Lemma 2 the pointwise operations, Lemma 3 the evaluation, and Lemmas 5, 6 and 7 give TO-COEFFICIENTS(y)(y) =L(y)= L(y). ■\blacksquare

Back to Point-value representation