The math optional, made finite. Daily Practice

Lagrange’s interpolation

At a Glance

Why This Chapter Matters

Lagrange interpolation appears in 5 of the last 13 years and always in Section B with high mark values (15–20 marks). The questions span five distinct patterns — from a straightforward computation to a confluent (Hermite-type) formula derived by a limiting argument — so this is one of the most varied numerical-analysis chapters in the corpus. The two 20-mark questions (2015, 2016) are the clearest tests of the core formula and its error bound; the three 15-mark questions (2017, 2020, 2025) require deeper structural understanding. The divided-difference route to Newton’s form (2025) and the confluent-limit derivation (2020) are the two patterns most likely to catch candidates who only practised the basic formula.

Minimum Theory

Lagrange interpolating polynomial. Given n+1n+1 distinct nodes x0,x1,,xnx_0,x_1,\ldots,x_n and values fi=f(xi)f_i=f(x_i), the unique polynomial PnP_n of degree n\le n satisfying Pn(xi)=fiP_n(x_i)=f_i is Pn(x)=i=0nfiLi(x),Li(x)=jixxjxixj.P_n(x)=\sum_{i=0}^n f_i\,L_i(x),\qquad L_i(x)=\prod_{j\ne i}\frac{x-x_j}{x_i-x_j}. The basis polynomials LiL_i satisfy Li(xj)=δijL_i(x_j)=\delta_{ij} and iLi(x)1\sum_i L_i(x)\equiv1 (partition of unity, useful check).

Interpolation error. If ff has (n+1)(n+1) continuous derivatives, the error at xx is f(x)Pn(x)=f(n+1)(ξ)(n+1)!ω(x),ω(x)=i=0n(xxi),f(x)-P_n(x)=\frac{f^{(n+1)}(\xi)}{(n+1)!}\,\omega(x),\qquad \omega(x)=\prod_{i=0}^n(x-x_i), for some ξ\xi in the smallest interval containing {x0,,xn,x}\{x_0,\ldots,x_n,x\}. Hence f(x)Pn(x)Mn+1(n+1)!ω(x),Mn+1=maxf(n+1)|f(x)-P_n(x)|\le\frac{M_{n+1}}{(n+1)!}\,|\omega(x)|,\qquad M_{n+1}=\max|f^{(n+1)}| over that interval.

Newton’s divided-difference form. An equivalent representation (especially efficient for unequally spaced nodes): Pn(x)=f[x0]+f[x0,x1](xx0)+f[x0,x1,x2](xx0)(xx1)+P_n(x)=f[x_0]+f[x_0,x_1](x-x_0)+f[x_0,x_1,x_2](x-x_0)(x-x_1)+\cdots where the divided differences are built recursively: f[xk]=fk,f[xi,,xk]=f[xi+1,,xk]f[xi,,xk1]xkxi.f[x_k]=f_k,\qquad f[x_i,\ldots,x_k]=\frac{f[x_{i+1},\ldots,x_k]-f[x_i,\ldots,x_{k-1}]}{x_k-x_i}.

Confluent (osculatory) interpolation. When two nodes x0x_0 and x0+ϵx_0+\epsilon coalesce (ϵ0\epsilon\to0), the Lagrange polynomial on {x0,x0+ϵ,x1}\{x_0,x_0+\epsilon,x_1\} converges to a formula matching f(x0)f(x_0), f(x0)f'(x_0), and f(x1)f(x_1) — the simplest Hermite interpolant. The error term picks up a double root at x0x_0: E(x)=16(xx0)2(xx1)f(ξ)E(x)=\tfrac{1}{6}(x-x_0)^2(x-x_1)f'''(\xi).

Question Archetypes

Five patterns cover every Lagrange interpolation question in the corpus.

ArchetypeYou are seeing this when…
lagrange-interpolationBuild the Lagrange polynomial and evaluate at a given point
lagrange-with-errorBuild the polynomial and compute an error bound and the actual error
lagrange-form-proofRewrite/prove the Lagrange formula in a stated equivalent form (difference form, CRT, etc.)
confluent-interpolationDerive a Hermite-type formula by letting two nodes coalesce (ϵ0\epsilon\to0)
divided-difference-interpolationFind the interpolating polynomial via Newton’s divided differences with an error term

lagrange-interpolation (1 question(s); 2015)

Recognition Cues

Solution Template

  1. Write down the four Lagrange basis polynomials Li(x)L_i(x) using the node values.
  2. Evaluate each LiL_i at the target point.
  3. Multiply by fif_i and sum.
  4. Optional: guess a low-degree polynomial fitting the data — if ff values are integers, often the data lies on an exact polynomial of manageable degree.

Worked Example(s)

2015 Paper 2, 2015-P2-Q6c (20 marks)

Find the Lagrange interpolating polynomial fitting the data below. Find f(1.5)f(1.5).

xx1-1223344
ff1-1111131316969

Lagrange basis at x=1.5x=1.5 (nodes x0=1,x1=2,x2=3,x3=4x_0=-1,x_1=2,x_2=3,x_3=4):

L0(x)=(x2)(x3)(x4)(3)(4)(5)=(x2)(x3)(x4)60,L_0(x)=\frac{(x-2)(x-3)(x-4)}{(-3)(-4)(-5)}=\frac{(x-2)(x-3)(x-4)}{-60}, L1(x)=(x+1)(x3)(x4)(3)(1)(2)=(x+1)(x3)(x4)6,L_1(x)=\frac{(x+1)(x-3)(x-4)}{(3)(-1)(-2)}=\frac{(x+1)(x-3)(x-4)}{6}, L2(x)=(x+1)(x2)(x4)(4)(1)(1)=(x+1)(x2)(x4)4,L_2(x)=\frac{(x+1)(x-2)(x-4)}{(4)(1)(-1)}=\frac{(x+1)(x-2)(x-4)}{-4}, L3(x)=(x+1)(x2)(x3)(5)(2)(1)=(x+1)(x2)(x3)10.L_3(x)=\frac{(x+1)(x-2)(x-3)}{(5)(2)(1)}=\frac{(x+1)(x-2)(x-3)}{10}.

At x=1.5x=1.5: L0=0.03125L_0=0.03125, L1=1.5625L_1=1.5625, L2=0.78125L_2=-0.78125, L3=0.1875L_3=0.1875. (Sum =1=1 ✓.)

P(1.5)=(1)(0.03125)+(11)(1.5625)+(31)(0.78125)+(69)(0.1875)P(1.5)=(-1)(0.03125)+(11)(1.5625)+(31)(-0.78125)+(69)(0.1875) =0.03125+17.187524.21875+12.9375=5.875.=-0.03125+17.1875-24.21875+12.9375=\boxed{5.875.}

Shortcut: check whether the data fits a low-degree exact polynomial. Test f(x)=x3+x+1f(x)=x^3+x+1: f(1)=1f(-1)=-1 ✓, f(2)=11f(2)=11 ✓, f(3)=31f(3)=31 ✓, f(4)=69f(4)=69 ✓. So P(x)=x3+x+1P(x)=x^3+x+1 and P(1.5)=3.375+1.5+1=5.875P(1.5)=3.375+1.5+1=5.875 ✓ — much faster once the guess works.

Common Traps


lagrange-with-error (1 question(s); 2016)

Recognition Cues

Solution Template

  1. Compute node values f(xi)f(x_i) numerically.
  2. Evaluate basis polynomials LiL_i at the target point; check Li=1\sum L_i=1.
  3. Compute Pn=f(xi)LiP_n = \sum f(x_i)L_i.
  4. Derive f(n+1)(x)f^{(n+1)}(x) and find (or bound) Mn+1=maxf(n+1)M_{n+1}=\max|f^{(n+1)}|. Look for amplitude form Ag(x)A\cdot g(x) with known maxg\max|g|.
  5. Evaluate ω(x)|\omega(x)| at the target point and over the interval.
  6. State the bound and compute E=f(target)Pn(target)E=|f(\text{target})-P_n(\text{target})|.

Worked Example(s)

2016 Paper 2, 2016-P2-Q6c (20 marks)

f(x)=e2xcos3xf(x)=e^{2x}\cos3x on [0,1][0,1]. Estimate f(0.5)f(0.5) using degree-3 Lagrange interpolation over nodes 0, 0.3, 0.6, 10,\ 0.3,\ 0.6,\ 1. Give the error bound over [0,1][0,1] and the actual error E(0.5)E(0.5).

Node values (xx in radians throughout):

xix_if(xi)f(x_i)
0.00.01.0000001.000000
0.30.31.1326431.132643
0.60.60.754338-0.754338
1.01.07.315129-7.315129

Basis values at x=0.5x=0.5 (check Li=1\sum L_i=1 ✓):

iiLi(0.5)L_i(0.5)
00.055556-0.055556
1+0.396825+0.396825
2+0.694444+0.694444
30.035714-0.035714

P3(0.5)=(1)(0.055556)+(1.132643)(0.396825)+(0.754338)(0.694444)+(7.315129)(0.035714)P_3(0.5)=(1)(-0.055556)+(1.132643)(0.396825)+(-0.754338)(0.694444)+(-7.315129)(-0.035714) 0.1313.\approx\boxed{0.1313.}

Error bound. Differentiate f=e2xcos3xf=e^{2x}\cos3x four times: f(4)(x)=e2x(120sin3x119cos3x).f^{(4)}(x)=e^{2x}(120\sin3x-119\cos3x). Recognise this as e2xAsin(3x+δ)e^{2x}\cdot A\sin(3x+\delta) with amplitude A=1202+1192=28561=169A=\sqrt{120^2+119^2}=\sqrt{28561}=169. So f(4)(x)169e2x169e21248.75on [0,1].|f^{(4)}(x)|\le169\,e^{2x}\le169e^2\approx1248.75\quad\text{on }[0,1]. At x=0.5x=0.5: ω(0.5)=(0.5)(0.2)(0.1)(0.5)=0.005=1/200|\omega(0.5)|=(0.5)(0.2)(0.1)(0.5)=0.005=1/200.

E(0.5)169e24!1200=169e248000.260.|E(0.5)|\le\frac{169e^2}{4!}\cdot\frac{1}{200}=\frac{169e^2}{4800}\approx\boxed{0.260.}

Actual error. f(0.5)=e1cos1.52.71828×0.070740.1923.f(0.5)=e^1\cos1.5\approx2.71828\times0.07074\approx0.1923. E(0.5)=0.19230.13130.061,E(0.5)=0.1923-0.1313\approx\boxed{0.061,} well inside the bound 0.2600.260 ✓.

Common Traps


lagrange-form-proof (1 question(s); 2017)

Recognition Cues

Solution Template

  1. Write the four Lagrange basis polynomials explicitly for nodes 1,0,1,2-1,0,1,2.
  2. Express Δ2u1=u12u0+u1\Delta^2u_{-1}=u_1-2u_0+u_{-1} and Δ2u0=u22u1+u0\Delta^2u_0=u_2-2u_1+u_0.
  3. Expand the right-hand side of the claimed formula, substituting y=1xy=1-x.
  4. Match the coefficient of each uiu_i on both sides against Li(x)L_i(x).

Worked Example(s)

2017 Paper 2, 2017-P2-Q6b (15 marks)

For equidistant values u1,u0,u1,u2u_{-1},u_0,u_1,u_2, show the Lagrange interpolant satisfies ux=yu0+xu1+y(y21)3!Δ2u1+x(x21)3!Δ2u0u_x=yu_0+xu_1+\frac{y(y^2-1)}{3!}\Delta^2u_{-1}+\frac{x(x^2-1)}{3!}\Delta^2u_0 with x+y=1x+y=1.

Four equidistant nodes at 1,0,1,2-1,0,1,2; interpolate at argument xx (measured in spacing units from u0u_0); write y=1xy=1-x.

Lagrange basis polynomials: L1=x(x1)(x2)6,L0=(x+1)(x1)(x2)2,L_{-1}=-\frac{x(x-1)(x-2)}{6},\quad L_0=\frac{(x+1)(x-1)(x-2)}{2}, L1=(x+1)x(x2)2,L2=(x+1)x(x1)6.L_1=-\frac{(x+1)x(x-2)}{2},\quad L_2=\frac{(x+1)x(x-1)}{6}.

Coefficient of u1u_{-1} in the claimed formula: y(y21)6=(1x)(1x2)6=(1x)(x)(2x)6=x(1x)(x2)6=L1.  \frac{y(y^2-1)}{6}=\frac{(1-x)(1-x^2)}{6}=\frac{(1-x)(-x)(2-x)}{6}=-\frac{x(1-x)(x-2)}{6}=L_{-1}.\;\checkmark

Coefficient of u2u_2: x(x21)6=x(x1)(x+1)6=L2.  \frac{x(x^2-1)}{6}=\frac{x(x-1)(x+1)}{6}=L_2.\;\checkmark

Coefficient of u0u_0: collect contributions from yy, the 2-2 in Δ2u1\Delta^2u_{-1}, and the +1+1 in Δ2u0\Delta^2u_0: y2y(y21)6+x(x21)6  y=1x  (x+1)(x1)(x2)2=L0.  y-\frac{2y(y^2-1)}{6}+\frac{x(x^2-1)}{6}\;\xrightarrow[y=1-x]{}\;\frac{(x+1)(x-1)(x-2)}{2}=L_0.\;\checkmark

Coefficient of u1u_1: similarly equals L1L_1. ✓

Since all four coefficients match, the formula is the Lagrange polynomial. \blacksquare

Common Traps


confluent-interpolation (1 question(s); 2020)

Recognition Cues

Solution Template

  1. Write the three-node Lagrange basis polynomials on x0,x0+ϵ,x1x_0,\,x_0+\epsilon,\,x_1.
  2. Taylor-expand f(x0+ϵ)=f(x0)+ϵf(x0)+O(ϵ2)f(x_0+\epsilon)=f(x_0)+\epsilon f'(x_0)+O(\epsilon^2).
  3. Group terms: the 1/ϵ1/\epsilon singularities from 0\ell_0 and 1\ell_1 cancel (they both multiply f(x0)f(x_0)); the ϵf(x0)\epsilon f'(x_0) piece of 1\ell_1 survives as a finite limit.
  4. Take ϵ0\epsilon\to0 in each coefficient and in the node factor of the error term (xx0)(xx0ϵ)(xx1)(xx0)2(xx1)(x-x_0)(x-x_0-\epsilon)(x-x_1)\to(x-x_0)^2(x-x_1).

Worked Example(s)

2020 Paper 2, 2020-P2-Q8b (15 marks)

Three-point Lagrange on x0x_0, x0+ϵx_0+\epsilon, x1x_1; take ϵ0\epsilon\to0 to derive the stated formula with error E(x)=16(xx0)2(xx1)f(ξ)E(x)=\tfrac16(x-x_0)^2(x-x_1)f'''(\xi).

Step 1 (three-node Lagrange). Basis: 0=(xx0ϵ)(xx1)(ϵ)(x0x1),1=(xx0)(xx1)ϵ(x0+ϵx1),2=(xx0)(xx0ϵ)(x1x0)(x1x0ϵ).\ell_0=\frac{(x-x_0-\epsilon)(x-x_1)}{(-\epsilon)(x_0-x_1)},\quad \ell_1=\frac{(x-x_0)(x-x_1)}{\epsilon(x_0+\epsilon-x_1)},\quad \ell_2=\frac{(x-x_0)(x-x_0-\epsilon)}{(x_1-x_0)(x_1-x_0-\epsilon)}.

Step 2 (Taylor expand). f(x0+ϵ)=f(x0)+ϵf(x0)+O(ϵ2)f(x_0+\epsilon)=f(x_0)+\epsilon f'(x_0)+O(\epsilon^2).

Step 3 (group and limit). The f(x0)f(x_0) contributions from 0\ell_0 and 1\ell_1 are 0f(x0)+1f(x0)\ell_0 f(x_0)+\ell_1 f(x_0); the 1/ϵ1/\epsilon pieces cancel. The surviving derivative term gives coefficient (xx0)(xx1)x0x1\tfrac{(x-x_0)(x-x_1)}{x_0-x_1} for f(x0)f'(x_0). The 2\ell_2 coefficient converges to (xx0)2(x1x0)2\tfrac{(x-x_0)^2}{(x_1-x_0)^2}.

Taking ϵ0\epsilon\to0: f(x)=(x1x)(x+x12x0)(x1x0)2f(x0)+(xx0)(xx1)x0x1f(x0)+(xx0)2(x1x0)2f(x1)+E(x).f(x)=\frac{(x_1-x)(x+x_1-2x_0)}{(x_1-x_0)^2}f(x_0)+\frac{(x-x_0)(x-x_1)}{x_0-x_1}f'(x_0)+\frac{(x-x_0)^2}{(x_1-x_0)^2}f(x_1)+E(x).

Step 4 (error). The three-node error is f(ξ)6(xx0)(xx0ϵ)(xx1)\tfrac{f'''(\xi)}{6}(x-x_0)(x-x_0-\epsilon)(x-x_1); as ϵ0\epsilon\to0 the node product becomes (xx0)2(xx1)(x-x_0)^2(x-x_1):   E(x)=16(xx0)2(xx1)f(ξ).  \boxed{\;E(x)=\frac{1}{6}(x-x_0)^2(x-x_1)\,f'''(\xi).\;}

Verification: substituting f(t)=t2f(t)=t^2 (so f=0f'''=0) should give exact reproduction — it does when the f(x0)f'(x_0) coefficient carries the sign (xx0)(xx1)x0x1\tfrac{(x-x_0)(x-x_1)}{x_0-x_1} (negative of what the printed paper states). The corrected sign has been verified.

Common Traps


divided-difference-interpolation (1 question(s); 2025)

Recognition Cues

Solution Template

  1. Build the divided-difference table: first-order f[xi,xi+1]=(fi+1fi)/(xi+1xi)f[x_i,x_{i+1}]=(f_{i+1}-f_i)/(x_{i+1}-x_i), then second-order f[x0,x1,x2]=(f[x1,x2]f[x0,x1])/(x2x0)f[x_0,x_1,x_2]=(f[x_1,x_2]-f[x_0,x_1])/(x_2-x_0), etc.
  2. Write Newton’s form: Pn(x)=f[x0]+f[x0,x1](xx0)+f[x0,x1,x2](xx0)(xx1)+P_n(x)=f[x_0]+f[x_0,x_1](x-x_0)+f[x_0,x_1,x_2](x-x_0)(x-x_1)+\cdots
  3. Expand and verify at all nodes.
  4. Error bound: E(x)Mn+1(n+1)!ω(x)|E(x)|\le\tfrac{M_{n+1}}{(n+1)!}|\omega(x)|. Find maxω\max|\omega| on the interval by setting ω=0\omega'=0.

Worked Example(s)

2025 Paper 2, 2025-P2-Q7b (15 marks)

Find the unique polynomial of degree 2\le2 fitting x:0,1,3x:0,1,3; f:1,3,55f:1,3,55. Obtain the truncation-error bound.

Divided-difference table:

OrderValue
f[0]=1f[0]=1, f[1]=3f[1]=3, f[3]=55f[3]=55
f[0,1]=(31)/1=2f[0,1]=(3-1)/1=2f[1,3]=(553)/2=26f[1,3]=(55-3)/2=26
f[0,1,3]=(262)/3=8f[0,1,3]=(26-2)/3=8

Newton’s form: P2(x)=1+2(x0)+8(x0)(x1)=1+2x+8x(x1)=8x26x+1.P_2(x)=1+2(x-0)+8(x-0)(x-1)=1+2x+8x(x-1)=\boxed{8x^2-6x+1.}

Check: P2(0)=1P_2(0)=1 ✓, P2(1)=3P_2(1)=3 ✓, P2(3)=7218+1=55P_2(3)=72-18+1=55 ✓.

Error bound. For 3-node interpolation: E(x)=f(ξ)6ω(x),ω(x)=x(x1)(x3).E(x)=\frac{f'''(\xi)}{6}\,\omega(x),\qquad \omega(x)=x(x-1)(x-3). Find maxω\max|\omega| on [0,3][0,3]: set ω(x)=3x28x+3=0\omega'(x)=3x^2-8x+3=0, giving x=(4±7)/3x=(4\pm\sqrt7)/3. At the interior critical points: max[0,3]ω=ω ⁣(4+73)2.1126.\max_{[0,3]}|\omega|=\left|\omega\!\left(\tfrac{4+\sqrt7}{3}\right)\right|\approx2.1126.

E(x)M362.11260.3521M3,M3=max[0,3]f.|E(x)|\le\frac{M_3}{6}\cdot2.1126\approx0.3521\,M_3,\qquad M_3=\max_{[0,3]}|f'''|.

Common Traps


Marks-Aware Writing

20-mark questions (2015, 2016): Expect to write out all four basis polynomials explicitly, evaluate each at the target point, and assemble the sum. For the error question (2016): derive f(4)f^{(4)} symbolically, bound it by recognising the amplitude form Ae2xA\cdot e^{2x}, then give both the pointwise and interval bounds.

15-mark questions (2017, 2020, 2025): Structure matters more than computation. For the form-proof (2017): verify each coefficient in sequence — that is the whole proof. For the confluent limit (2020): a clear description of the ϵ0\epsilon\to0 mechanism (singularities cancel because both multiply f(x0)f(x_0)) is worth as many marks as the final formula. For divided differences (2025): write the difference table explicitly; the Newton polynomial and error bound follow mechanically.

Practice Set

YearPaper/QMarksArchetypeOne-line hint
2016P2-Q6c20lagrange-with-error1202+1192=169\sqrt{120^2+119^2}=169 gives the amplitude of f(4)f^{(4)}; bound 169e2\le169e^2 on [0,1][0,1]; pointwise $
2020P2-Q8b15confluent-interpolation1/ϵ1/\epsilon terms from 0,1\ell_0,\ell_1 cancel; the surviving limit is the f(x0)f'(x_0) coefficient

We've mapped all 13 years of this exam. Get new chapters, tools, and solutions as we release them — free.