Tomorrow, I will have a mid-term exam including Lagrange polynomial. So, I summarize down these content. There won’t be a Mandarin version, because I am so lazy to translate it. Besides, you may get better reading experience here.

Lagrange Polynomial

The Lagrange polynomial is a method of polynomial interpolation that allows us to approximate a function f(x)f(x) by a polynomial P(x)P(x). Given the fucntion passthrough a set of points (x0,y0),(x_0, y_0), (x1,y1),,(xn,yn)(x_1, y_1), \ldots, (x_n, y_n), where xix_i are distinct. The main idea of the Lagrange Polynomial is to construct a polynomial directly using a linear combination of basis polynomials, denoted as Li(x)L_i(x) which are defined as follows:

Li(xj)=δij={1if i=j0if ijL_i(x_j) = \delta_{ij} = \begin{cases} 1 & \text{if } i = j \\ 0 & \text{if } i \neq j \end{cases}

The core logic relies on the property of Li(xj)L_i(x_j), which ensures that each basis polynomial contributes to the final interpolation only at its corresponding point. To ensure Li(xj)=0L_i(x_j) = 0 when iji \neq j, the function Li(x)L_i(x) must contain the term (xxj)(x - x_j) for all jij \neq i.

Li(x)=j=0,jinxxjL_i(x) = \prod_{j=0, j \neq i}^{n} x - x_j

To satisfy the condition Li(xi)=1L_i(x_i) = 1, we need to normalize Li(x)L_i(x) by dividing it by its value at xix_i. Hence the normalized basis polynomial is given by:

Ln,i(x)=j=0,jinxxjxixjL_{n,i}(x) = \prod_{j=0, j \neq i}^{n} \frac{x - x_j}{x_i - x_j}

Finally, we scale each basis polynomial by its corresponding yiy_i value and sum them up to get the final Lagrange polynomial:

P(x)=i=0nf(xi)Li(x)\begin{equation} P(x) = \sum_{i=0}^{n} f(x_i) L_i(x) \end{equation}

Besides, the Lagrange polynomial can also be expressed in another form. Let us define the nodal polynomial Q(x)Q(x) as the product of all linear factors associated with the data points:

Q(x)=j=0n(xxj)Q(x) = \prod_{j=0}^{n} (x - x_j)

Taking the natural logarithm on both sides to simplify the differentiation of the product:

lnQ(x)=j=0nln(xxj)\ln Q(x) = \sum_{j=0}^{n} \ln(x - x_j)

Differentiating with respect to xx yields the logarithmic derivative:

Q(x)Q(x)=j=0n1xxj\frac{Q'(x)}{Q(x)} = \sum_{j=0}^{n} \frac{1}{x - x_j}

Multiplying both sides by Q(x)Q(x), we obtain the general expression for the derivative Q(x)Q'(x):

Q(x)=j=0nQ(x)xxjQ'(x) = \sum_{j=0}^{n} \frac{Q(x)}{x - x_j}

When evaluating this derivative at a specific node x=xix = x_i, the limit must be considered since Q(xi)=0Q(x_i) = 0. Applying the product rule isolates the non-zero term:

Q(xi)=j=0nQ(xi)(xixj)={0if ijj=0jin(xixj)if i=jQ'(x_i) = \sum_{j=0}^{n} \frac{Q(x_i)}{(x_i - x_j)} = \begin{cases} 0 & \text{if } i \neq j \\ \prod_{\substack{j=0 \\ j \neq i}}^{n} (x_i - x_j) & \text{if } i = j \end{cases}

Using this result, the Lagrange basis polynomial Ln,i(x)L_{n,i}(x) can be elegantly rewritten in terms of Q(x)Q(x) and Q(xi)Q'(x_i):

Ln,i(x)=Q(x)xxiQ(xi)=Q(x)(xxi)Q(xi)L_{n, i}(x) = \frac{\frac{Q(x)}{x - x_i}}{Q'(x_i)} = \frac{Q(x)}{(x - x_i)Q'(x_i)}

Finally, the interpolating polynomial P(x)P(x) is constructed as a linear combination of these basis polynomials and the given function values f(xi)f(x_i):

P(x)=i=0nQ(x)(xxi)Q(xi)f(xi)\begin{equation} P(x) = \sum_{i=0}^{n} \frac{Q(x)}{(x - x_i)Q'(x_i)} \cdot f(x_i) \end{equation}

Uniqueness

Suppose there are two different polynomials P(x)P(x) and Q(x)Q(x) that both interpolate the same set of points. Let

R(x)=P(x)Q(x)R(x) = P(x) - Q(x)

Since both P(x)P(x) and Q(x)Q(x) interpolate the same points, we have

R(xi)=P(xi)Q(xi)=0i=0,1,,nR(x_i) = P(x_i) - Q(x_i) = 0 \quad \forall i = 0, 1, \ldots, n

This means that R(x)R(x) has at least n+1n+1 distinct roots. However, a non-zero polynomial of degree at most nn can have at most nn distinct roots. Therefore, the only possibility is that R(x)R(x) is the zero polynomial, which implies that P(x)=Q(x)P(x) = Q(x) for all xx. Hence, the Lagrange polynomial is unique.

Error Analysis

Since we have known the points of interpolation, the error on xix_i is zero. However, for any other point xx that is not in the set of interpolation points, we construct a polynomial that vanishes at all the interpolation points, with a coefficient cc to be determined:

f(x)=P(x)+cj=0n(xxj)f(x) = P(x) + c \prod_{j=0}^{n} (x - x_j)

Since we do not know whether the error for all the points is linear or not, we cannot simply suppose that cc is a constant. Instead, we need to see cc as a function of xx. Given Q(x)=j=0n(xxj)Q(x) = \prod_{j=0}^{n} (x - x_j), we can rewrite the above equation as:

f(x)=P(x)+c(x)Q(x)\begin{equation} f(x) = P(x) + c(x) Q(x) \end{equation}

To analyze the error, we define a new auxiliary function F(z)F(z) to assist our analysis:

F(z)=f(z)P(z)c(x)Q(z)F(z) = f(z) - P(z) - c(x) Q(z)

By construction, F(z)F(z) has at least n+2n+2 distinct roots x0,x1,,xnx_0, x_1, \ldots, x_n, and it also trivially evaluates to zero at z=xz = x (since F(x)=f(x)P(x)c(x)Q(x)=0F(x) = f(x) - P(x) - c(x)Q(x) = 0 ). If we assume that f(z)f(z) is sufficiently smooth (i.e., it has at least n+1n+1 continuous derivatives), then by the repeated application of Rolle’s theorem, there must exist a point ξ\xi in the interval containing both the interpolation points and xx, such that the (n+1)-th derivative of F(z)F(z) vanishes:

F(n+1)(ξ)=0F^{(n+1)}(\xi) = 0

Calculating the (n+1)-th derivative of F(z)F(z), we have:

F(n+1)(ξ)=f(n+1)(ξ)P(n+1)(ξ)c(x)Q(n+1)(ξ)F^{(n+1)}(\xi) = f^{(n+1)}(\xi) - P^{(n+1)}(\xi) - c(x) Q^{(n+1)}(\xi)

Since P(z)P(z) is a polynomial of degree at most nn, its (n+1)-th derivative is zero. Additionally, since Q(z)Q(z) is a product of (n+1)(n+1) linear factors, its (n+1)-th derivative is (n+1)!(n+1)!. Therefore, the above equation simplifies to:

0=f(n+1)(ξ)c(x)(n+1)!0 = f^{(n+1)}(\xi) - c(x) (n+1)!

Solving for c(x)c(x) gives us:

c(x)=f(n+1)(ξ)(n+1)!c(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!}

Substituting this back into equation (3) yields the error formula for the Lagrange interpolation:

f(x)=P(x)+f(n+1)(ξ)(n+1)!j=0n(xxj)\begin{equation} f(x) = P(x) + \frac{f^{(n+1)}(\xi)}{(n+1)!} \prod_{j=0}^{n} (x - x_j) \end{equation}

Derivative of Lagrange Polynomial

To find the derivative of the Lagrange polynomial P(x)P(x), we need equation (1) and the expression for Ln,i(x)L_{n,i}(x) in terms of Q(x)Q(x) and Q(xi)Q'(x_i):

P(x)=i=0nf(xi)Ln,i(x)\begin{equation} P(x) = \sum_{i=0}^{n} f(x_i) L_{n,i}(x) \end{equation} Ln,i(x)=Q(x)(xxi)Q(xi)\begin{equation} L_{n, i}(x) = \frac{Q(x)}{(x - x_i)Q'(x_i)} \end{equation}

Differentiating P(x)P(x) with respect to xx gives us:

P(x)=i=0nf(xi)Ln,i(x)P'(x) = \sum_{i=0}^{n} f(x_i) L'_{n,i}(x)

To compute Ln,i(x)L'_{n,i}(x), we apply equation (6).

Q(x)=(xxi)Q(xi)Ln,i(x)Q(x) = (x - x_i)Q'(x_i) L_{n,i}(x)

Differentiating both sides with respect to xx yields:

Q(x)=Q(xi)Ln,i(x)+(xxi)Q(xi)Ln,i(x)Q'(x) = Q'(x_i) L_{n,i}(x) + (x - x_i) Q'(x_i) L'_{n,i}(x)
  • Case 1:

    If x=xjx = x_j and jij \neq i, the above equation simplifies to

    Q(xj)=Q(xi)[Ln,i(xj)+(xjxi)Ln,i(xj)]Q'(x_j) = Q'(x_i) [L_{n, i}(x_j) + (x_j - x_i) L'_{n,i}(x_j)]

    where Ln,i(xj)=0L_{n, i}(x_j) = 0 since jij \neq i. Therefore, we can solve for Ln,i(xj)L'_{n,i}(x_j):

    Ln,i(xj)=Q(xj)(xjxi)Q(xi)L'_{n,i}(x_j) = \frac{Q'(x_j)}{(x_j - x_i) Q'(x_i)}
  • Case 2:

    If x=xjx = x_j,and j=ij = i, we need to do one more times of defferentiation to simplify the expression.

    Q(xj)=Q(xi)[Ln,i(xj)+Ln,i(xj)+(xjxi)Ln,i(xj)]Q''(x_j) = Q'(x_i) [L_{n,i}'(x_j) + L_{n,i}'(x_j) + (x_j - x_i) L''_{n,i}(x_j)]

    Since xi=xjx_i = x_j, the above equation simplifies to

    Ln,i(xj)=Q(xj)2Q(xi)L'_{n,i}(x_j) = \frac{Q''(x_j)}{2 Q'(x_i)}

Error Analysis of the Derivative

Recall the standard error formula for polynomial interpolation. For a sufficiently differentiable function f(x)f(x) interpolated by a polynomial P(x)P(x) of degree nn at distinct nodes x0,x1,,xnx_0, x_1, \dots, x_n, the interpolation error is given by:

f(x)=P(x)+Q(x)(n+1)!f(n+1)(ξx) f(x) = P(x) + \frac{Q(x)}{(n+1)!} f^{(n+1)}(\xi_x)

where Q(x)=i=0n(xxi)Q(x) = \prod_{i=0}^{n} (x - x_i) is the nodal polynomial, and ξx\xi_x is some point in the smallest interval containing xx and all nodes xix_i. Crucially, ξx\xi_x depends on xx, meaning it must be treated as a function ξ(x)\xi(x) during differentiation.

To find the error of the derivative, we differentiate both sides with respect to xx. Applying the product rule and the chain rule to the error term yields:

f(x)=P(x)+1(n+1)![Q(x)f(n+1)(ξ(x))+Q(x)f(n+2)(ξ(x))ξ(x)]R(x) f'(x) = P'(x) + \frac{1}{(n+1)!} \underbrace{\left[ Q'(x) f^{(n+1)}(\xi(x)) + Q(x) f^{(n+2)}(\xi(x)) \cdot \xi'(x) \right]}_{R(x)}

Let us define the bracketed term as R(x)R(x).

The derivative of the nodal polynomial, Q(x)Q'(x), can be expanded using the product rule as follows:

Q(x)=j=0nQ(x)xxj=j=0nk=0kjn(xxk) Q'(x) = \sum_{j=0}^{n} \frac{Q(x)}{x - x_j} = \sum_{j=0}^{n} \prod_{\substack{k=0 \\ k \neq j}}^{n} (x - x_k)

We are often interested in the derivative error precisely at the interpolation nodes, i.e., when x=xix = x_i. Let us evaluate R(x)R(x) at xix_i:

R(xi)=Q(xi)f(n+1)(ξ(xi))+Q(xi)f(n+2)(ξ(xi))ξ(xi) R(x_i) = Q'(x_i) f^{(n+1)}(\xi(x_i)) + Q(x_i) f^{(n+2)}(\xi(x_i)) \cdot \xi'(x_i)

Since xix_i is a root of the nodal polynomial, Q(xi)=0Q(x_i) = 0. This mathematical property conveniently eliminates the complex second term involving the unknown derivative ξ(xi)\xi'(x_i):

R(xi)=Q(xi)f(n+1)(ξ(xi))+0 R(x_i) = Q'(x_i) f^{(n+1)}(\xi(x_i)) + 0

By substituting x=xix = x_i into our expansion for Q(x)Q'(x), all terms in the summation vanish except the term where j=ij=i, yielding:

Q(xi)=k=0kin(xixk) Q'(x_i) = \prod_{\substack{k=0 \\ k \neq i}}^{n} (x_i - x_k)

Therefore, the exact formulation for the derivative at an interpolation node xix_i simplifies to:

f(xi)=P(xi)+f(n+1)(ξ(xi))(n+1)!k=0kin(xixk) f'(x_i) = P'(x_i) + \frac{f^{(n+1)}(\xi(x_i))}{(n+1)!} \prod_{\substack{k=0 \\ k \neq i}}^{n} (x_i - x_k)

Integration of Lagrange Interpolation

Let the integration interval [a,b][a, b] be partitioned into nn equal subintervals with step size Δx=ban\Delta x = \frac{b-a}{n}, where nn is an even integer. The grid points are defined as:

xi=a+iΔx\begin{equation*} x_i = a + i\Delta x \end{equation*}

To derive Simpson’s rule, we approximate the integrand f(x)f(x) over each subinterval [xi1,xi+1][x_{i-1}, x_{i+1}] using a quadratic polynomial P2(x)=ax2+bx+cP_2(x) = ax^2 + bx + c. This parabola is uniquely determined by passing through three adjacent points: (xi1,f(xi1))(x_{i-1}, f(x_{i-1})), (xi,f(xi))(x_i, f(x_i)), and (xi+1,f(xi+1))(x_{i+1}, f(x_{i+1})).

Using Lagrange interpolation, this quadratic polynomial can be expressed as a linear combination of Lagrange basis polynomials:

P2(x)=L0(x)f(xi1)+L1(x)f(xi)+L2(x)f(xi+1)\begin{equation*} P_2(x) = L_0(x)f(x_{i-1}) + L_1(x)f(x_i) + L_2(x)f(x_{i+1}) \end{equation*}

The basis polynomials L0(x)L_0(x), L1(x)L_1(x), and L2(x)L_2(x) are formulated as follows. We simplify the denominators by utilizing the uniform spacing constraint xkxk1=Δxx_k - x_{k-1} = \Delta x:

L0(x)=(xxi)(xxi+1)(xi1xi)(xi1xi+1)=(xxi)(xxi+1)2(Δx)2L1(x)=(xxi1)(xxi+1)(xixi1)(xixi+1)=(xxi1)(xxi+1)(Δx)2L2(x)=(xxi1)(xxi)(xi+1xi1)(xi+1xi)=(xxi1)(xxi)2(Δx)2\begin{align*} L_0(x) &= \frac{(x-x_i)(x-x_{i+1})}{(x_{i-1}-x_i)(x_{i-1}-x_{i+1})} = \frac{(x-x_i)(x-x_{i+1})}{2(\Delta x)^2} \\[1em] L_1(x) &= \frac{(x-x_{i-1})(x-x_{i+1})}{(x_i-x_{i-1})(x_i-x_{i+1})} = \frac{(x-x_{i-1})(x-x_{i+1})}{-(\Delta x)^2} \\[1em] L_2(x) &= \frac{(x-x_{i-1})(x-x_i)}{(x_{i+1}-x_{i-1})(x_{i+1}-x_i)} = \frac{(x-x_{i-1})(x-x_i)}{2(\Delta x)^2} \end{align*}

To find the approximate area under f(x)f(x), we integrate P2(x)P_2(x) over the sub-domain [xi1,xi+1][x_{i-1}, x_{i+1}]. We then sum these local integrals over the n/2n/2 sub-domains to cover the entire interval [a,b][a, b]:

i=1,3,5n1xi1xi+1P2(x)dx=i=1,3,5n1xi1xi+1[L0(x)f(xi1)+L1(x)f(xi)+L2(x)f(xi+1)]dx\begin{align*} \sum_{i=1, 3, 5\dots}^{n-1} \int_{x_{i-1}}^{x_{i+1}} P_2(x) \,dx &= \sum_{i=1, 3, 5\dots}^{n-1} \int_{x_{i-1}}^{x_{i+1}} \Big[ L_0(x)f(x_{i-1}) + L_1(x)f(x_i) + L_2(x)f(x_{i+1}) \Big] \,dx \end{align*}

To elegantly evaluate the integral of each basis polynomial, we apply the affine transformation x=xi+tΔxx = x_i + t\Delta x, which implies dx=Δxdtdx = \Delta x \,dt. This standardizes the limits of integration from [xi1,xi+1][x_{i-1}, x_{i+1}] to [1,1][-1, 1].

xi1xi+1L0(x)dx=xi1xi+1(xxi)(xxi+1)2(Δx)2dx=11(tΔx)(t1)Δx2(Δx)2Δxdt=Δx211(t2t)dt=Δx2[13t312t2]11=13Δxxi1xi+1L1(x)dx=xi1xi+1(xxi1)(xxi+1)(Δx)2dx=11(t+1)Δx(t1)Δx(Δx)2Δxdt=Δx11(t21)dt=Δx[13t3t]11=43Δxxi1xi+1L2(x)dx=xi1xi+1(xxi1)(xxi)2(Δx)2dx=11(t+1)Δx(tΔx)2(Δx)2Δxdt=Δx211(t2+t)dt=Δx2[13t3+12t2]11=13Δx\begin{align*} \int_{x_{i-1}}^{x_{i+1}} L_0(x) \,dx &= \int_{x_{i-1}}^{x_{i+1}} \frac{(x-x_i)(x-x_{i+1})}{2(\Delta x)^2} \,dx \\ &= \int_{-1}^{1} \frac{(t\Delta x) \cdot (t-1)\Delta x}{2(\Delta x)^2} \Delta x \,dt \\ &= \frac{\Delta x}{2} \int_{-1}^{1} (t^2 - t) \,dt \\ &= \frac{\Delta x}{2} \left[ \frac{1}{3}t^3 - \frac{1}{2}t^2 \right]_{-1}^{1} = \frac{1}{3}\Delta x \\[1.5em] \int_{x_{i-1}}^{x_{i+1}} L_1(x) \,dx &= \int_{x_{i-1}}^{x_{i+1}} \frac{(x-x_{i-1})(x-x_{i+1})}{-(\Delta x)^2} \,dx \\ &= \int_{-1}^{1} \frac{(t+1)\Delta x \cdot (t-1)\Delta x}{-(\Delta x)^2} \Delta x \,dt \\ &= -\Delta x \int_{-1}^{1} (t^2 - 1) \,dt \\ &= -\Delta x \left[ \frac{1}{3}t^3 - t \right]_{-1}^{1} = \frac{4}{3}\Delta x \\[1.5em] \int_{x_{i-1}}^{x_{i+1}} L_2(x) \,dx &= \int_{x_{i-1}}^{x_{i+1}} \frac{(x-x_{i-1})(x-x_i)}{2(\Delta x)^2} \,dx \\ &= \int_{-1}^{1} \frac{(t+1)\Delta x \cdot (t\Delta x)}{2(\Delta x)^2} \Delta x \,dt \\ &= \frac{\Delta x}{2} \int_{-1}^{1} (t^2 + t) \,dt \\ &= \frac{\Delta x}{2} \left[ \frac{1}{3}t^3 + \frac{1}{2}t^2 \right]_{-1}^{1} = \frac{1}{3}\Delta x \end{align*}

Substituting these algebraically evaluated integrals back into the global summation yields the composite Simpson’s Rule:

abf(x)dxi=1,3,5n1[13Δxf(xi1)+43Δxf(xi)+13Δxf(xi+1)]=Δx3i=1,3,5n1[f(xi1)+4f(xi)+f(xi+1)]\begin{align*} \int_a^b f(x) \,dx &\approx \sum_{i=1, 3, 5\dots}^{n-1} \left[ \frac{1}{3}\Delta x f(x_{i-1}) + \frac{4}{3}\Delta x f(x_i) + \frac{1}{3}\Delta x f(x_{i+1}) \right] \\ &= \frac{\Delta x}{3} \sum_{i=1, 3, 5\dots}^{n-1} \Big[ f(x_{i-1}) + 4f(x_i) + f(x_{i+1}) \Big] \end{align*}

Lagrange Polynomial

作者

Windson

發布日期

2026 - 05 - 03

版權

CC-BY-SA 4.0