Maths WorkshopMaths problems with full solutions
Exercise 1823Algebra › PolynomialsL1Added 3 Nov 2026

Lagrange interpolation

#interpolation#Lagrange#polynomial

Statement

Find the unique polynomial PP of degree ≤2\le2 such that P(0)=1P(0)=1, P(1)=3P(1)=3, P(2)=7P(2)=7.

Hint

Use Lagrange interpolation: P(X)=∑iyi∏j≠iX−xjxi−xjP(X)=\sum_i y_i\prod_{j\neq i}\frac{X-x_j}{x_i-x_j}.

Show solutionHide solution

Solution

Lagrange basis.
- L0(X)=(X−1)(X−2)(0−1)(0−2)=(X−1)(X−2)2L_0(X)=\frac{(X-1)(X-2)}{(0-1)(0-2)}=\frac{(X-1)(X-2)}{2}.
- L1(X)=X(X−2)(1−0)(1−2)=−X(X−2)L_1(X)=\frac{X(X-2)}{(1-0)(1-2)}=-X(X-2).
- L2(X)=X(X−1)(2−0)(2−1)=X(X−1)2L_2(X)=\frac{X(X-1)}{(2-0)(2-1)}=\frac{X(X-1)}{2}.

Interpolation.
P(X)=1⋅L0+3⋅L1+7⋅L2.P(X)=1\cdot L_0+3\cdot L_1+7\cdot L_2.
Compute:
P(X)=(X−1)(X−2)2−3X(X−2)+7X(X−1)2.P(X)=\frac{(X-1)(X-2)}{2}-3X(X-2)+\frac{7X(X-1)}{2}.
Expand: X2−3X+22−3X2+6X+7X2−7X2=X2−3X+2+7X2−7X2−3X2+6X=4X2−5X+1−3X2+6X=X2+X+1\frac{X^2-3X+2}{2}-3X^2+6X+\frac{7X^2-7X}{2}=\frac{X^2-3X+2+7X^2-7X}{2}-3X^2+6X=4X^2-5X+1-3X^2+6X=X^2+X+1.

Check. P(0)=1P(0)=1, P(1)=3P(1)=3, P(2)=7P(2)=7. Correct.

Conclusion. P(X)=X2+X+1P(X)=X^2+X+1.