Discussion 5A

Polynomials

  • A polynomial of degree dd has the form p(x)=adxd+ad1xd1++a1x1+a0p(x) = a_d x^d + a_{d-1} x^{d-1} + \cdots + a_1 x^1 + a_0
  • A root rr of a polynomial is a value such that p(r)=0p(r) = 0
  • A polynomial with degree dd has dd roots, not necessarily distinct
  • If rr is a root then p(x)p(x) can be factored as p(x)=(xr)q(x)p(x) = (x-r) q(x) where q(x)q(x) has degree d1d-1
  • With d+1d+1 points (xi,p(xi))(x_i, p(x_i)) there is one degree dd polynomial that fits the points
  • two points determine a line, three points determine a quadratic, etc.
  • this can be interpreted as the number of points required to figure out the d+1d+1 coefficients of p(x)p(x)

Lagrange Interpolation

Given d+1d+1 points, how do you find a degree dd polynomial that fits all d+1d+1 points?

The idea is similar to that of Chinese Remainder Theorem:
  • Let the points given be (x0,y0),(x1,y1),,(xd,yd)(x_0, y_0), (x_1, y_1), \cdots , (x_{d}, y_d)
  • For each xix_i, create a polynomial Δxi(x)={1if x=xi0otherwise\Delta_{x_i} (x) = \begin{cases} 1 & \text{if } x=x_i \\ 0 & \text{otherwise} \end{cases}
  • Then the polynomial p(x)=y0Δx0(x)+y1Δx1(x)++ydΔxd(x)p(x) = y_0 \Delta_{x_0} (x) + y_1 \Delta_{x_1} (x) + \cdots + y_d \Delta_{x_d} (x) fits all the points
  • p(x0)=y0Δx0(x0)+y1Δx1(x0)++ydΔxd(x0)=y0+0++0=y0p(x_0) = y_0 \Delta_{x_0} (x_0) + y_1 \Delta_{x_1} (x_0) + \cdots + y_d \Delta_{x_d} (x_0) = y_0 + 0 + \cdots + 0 = y_0

Letting Δxi(x)=jixxjjixixj=(xx0)(xxi1)(xxi+1)(xxd)(xix0)(xixi1)(xixi+1)(xixd)\Delta_{x_i} (x) = \frac{\prod_{j \neq i} x - x_j}{\prod_{j \neq i} x_i - x_j} = \frac{(x-x_0) \cdots (x-x_{i-1}) (x-x_{i+1}) \cdots (x-x_d)}{(x_i-x_0) \cdots (x_i-x_{i-1}) (x_i-x_{i+1}) \cdots (x_i-x_d)} works because when you plug in xix_i, all terms in the numerator and denominator cancel, evaluating to 11, and when you plug in another value xjx_j, one of the terms in the numerator is (xjxj)(x_j-x_j), so the polynomial evaluates to 00.