16.4 KB · commit a9602da
← Previous: NM-4.3 Non-Linear Regression | 🏠 Index | Next: NM-4.7 Newton's Forward Difference →
Section: A (Numerical Methods) | Priority: 🔴 | Exam Frequency: 7/8 years + CT Sources: Jain Ch.3 §3.9.1 (p. 101–103); Fahad Notes Class-05; Raidah Notes p.10–12
Lagrange's interpolation is the most tested interpolation method in the entire course. It appears in 7 out of 8 semester finals and in class tests. The formula handles unevenly spaced data directly without requiring finite difference tables. Exams test both theoretical derivation and multi-point numerical problems.
Lagrange's Interpolation Formula: "Given the (n+1) points (x0,y0), (x1,y1), ..., (xn,yn) where the values of x need not necessarily be equally spaced, we wish to find a polynomial of degree n, say Ln(x), such that Ln(xi)=y(xi)=yi,i=0,1,…,n." — Jain, §3.9.1 (p. 101)
Kronecker Delta Property of Basis Polynomials: "li(xj)={1,0,if i=jif i=j." — Jain, §3.9.1 (p. 102)
Partition of Unity Property: "∑i=0nli(x)=1 for all x." — Jain, §3.9.1 (p. 102)
Given n+1 distinct points (x0,y0),(x1,y1),…,(xn,yn), there exists a unique polynomial Pn(x) of degree at most n that passes through every point:
Pn(xi)=yifor i=0,1,…,nLagrange constructs this polynomial as a linear combination of basis polynomials Li(x):
Pn(x)=i=0∑nyiLi(x)Each basis polynomial Li(x) is designed to satisfy two specific conditions:

Figure 4.6: the left panel is the Kronecker delta property made visible. Each Li is a cardinal function, 1 at its own node and 0 everywhere else on the table. The right panel is the sum ∑yiLi(x), which is forced through every point because at node xk only Lk survives.
To make Li(x)=0 at every xj where j=i, the numerator must contain the product:
j=0j=i∏n(x−xj)=(x−x0)…(x−xi−1)(x−xi+1)…(x−xn)To make Li(xi)=1, we divide by the value of this product evaluated at x=xi:
Li(x)=j=0j=i∏nxi−xjx−xjWhen evaluated at x=xk:
Therefore, substituting x=xk into Pn(x):
Pn(xk)=i=0∑nyiLi(xk)=yk(1)+i=k∑yi(0)=ykThe polynomial matches every given point exactly.
Always compute this sum as an arithmetic sanity check before multiplying by yi. 2. Spacing-agnostic: The spacing between nodes xi can be completely arbitrary. No common difference h is required. 3. Interpolation error: If f(x) has n+1 continuous derivatives, the truncation error is:
Rn(x)=f(x)−Pn(x)=(n+1)!f(n+1)(ξ)i=0∏n(x−xi)for some ξ in the interval containing all xi and x.
| Comparison Feature | Newton's Interpolation | Lagrange's Interpolation |
|---|---|---|
| Mathematical structure | Incremental sum of divided differences | Direct weighted sum of products |
| Adding a new data point | Retains all previous terms; adds one new term | Must recompute all basis polynomials |
| Unequal spacing | Requires divided differences table | Works directly without extra machinery |
| Equal spacing | Fast forward/backward difference tables | Ignores equal spacing benefits |
| Evaluation work | O(n) after table setup | O(n2) arithmetic operations |
| Stability | Better when evaluated near edges | Degrades rapidly for high degrees |
Find y(2) from the following data using Lagrange's formula:
| x | 0 | 1 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| y | 0 | 1 | 81 | 256 | 625 |
Here n=4 (five points) and the target is x=2.
Step 1: Compute the five Lagrange basis weights at x=2
L0(2)=(0−1)(0−3)(0−4)(0−5)(2−1)(2−3)(2−4)(2−5)=(−1)(−3)(−4)(−5)(1)(−1)(−2)(−3)=60−6=−101=−0.1 L1(2)=(1−0)(1−3)(1−4)(1−5)(2−0)(2−3)(2−4)(2−5)=(1)(−2)(−3)(−4)(2)(−1)(−2)(−3)=−24−12=21=0.5 L2(2)=(3−0)(3−1)(3−4)(3−5)(2−0)(2−1)(2−4)(2−5)=(3)(2)(−1)(−2)(2)(1)(−2)(−3)=1212=1.0 L3(2)=(4−0)(4−1)(4−3)(4−5)(2−0)(2−1)(2−3)(2−5)=(4)(3)(1)(−1)(2)(1)(−1)(−3)=−126=−21=−0.5 L4(2)=(5−0)(5−1)(5−3)(5−4)(2−0)(2−1)(2−3)(2−4)=(5)(4)(2)(1)(2)(1)(−1)(−2)=404=101=0.1Step 2: Check the sum of weights
i=0∑4Li(2)=−0.1+0.5+1.0−0.5+0.1=1.0(Verified!)Step 3: Assemble the solution
y(2)=i=0∑4yiLi(2)=0(−0.1)+1(0.5)+81(1.0)+256(−0.5)+625(0.1) y(2)=0+0.5+81−128+62.5=16 y(2)=16Notice that the data points follow y=x4 (04=0,14=1,34=81,44=256,54=625). The fifth point on this curve is 24=16, which confirms the result.
| Year | Target & Given Points | Key Answer |
|---|---|---|
| 2018 Q.3(a) | Theory: Explain the use of Lagrange's formula | Four main advantages and limitations |
| 2018 Q.3(c) | Find f(2.5) from (1,0),(2,1),(3,8) | f(2.5)=3.75 |
| 2019 Q.4(b) | Robot arm path: (2,7.2),(4.25,7.1),(5.25,6.0), find y(4.00) | y(4.00)=7.2735 in. |
| 2021 Q.3(b) | Theory: Differentiate Newton vs. Lagrange | Newton updates and reuses; Lagrange rebuilds once and is spacing-agnostic |
| 2021 Q.3(d) / 2023 Q.2(b) | x∈{0,1,3,4,5}, y∈{0,1,81,256,625}, find y(2) | y(2)=16 |
| 2024 Q.2(c) | Theory: Describe method, advantages and disadvantages | Pn(x)=i=0∑nyij=i∏xi−xjx−xj |
| CT-02A Q.1 | Pollutant concentration at 5 km from (2,18),(4,26),(7,43),(10,60) | C(5)=31.25 mg/L |
Appeared: 2018 Q.3(a) — (03 marks)
Full Answer:
Use: Lagrange's formula estimates an intermediate value f(x) at a point x within the range of a tabulated set (xi,fi), without requiring the tabulated abscissae to be equally spaced.
The formula: For n+1 points:
f(x)≈i=0∑nfij=0j=i∏nxi−xjx−xjWhy it is used:
Limitations: Adding a new data point requires recalculating all basis polynomials. It also requires O(n2) operations for each evaluation point.
Appeared: 2018 Q.3(c) — (03 marks)
Full Answer:
Given data:
| x | 1 | 2 | 3 |
|---|---|---|---|
| f(x) | 0 | 1 | 8 |
With three points (x0=1,x1=2,x2=3 and f0=0,f1=1,f2=8), the second-degree Lagrange formula is:
f(x)=(x0−x1)(x0−x2)(x−x1)(x−x2)f0+(x1−x0)(x1−x2)(x−x0)(x−x2)f1+(x2−x0)(x2−x1)(x−x0)(x−x1)f2Evaluate each basis term at x=2.5:
L0(2.5)=(1−2)(1−3)(2.5−2)(2.5−3)=(−1)(−2)(0.5)(−0.5)=2−0.25=−0.125 L1(2.5)=(2−1)(2−3)(2.5−1)(2.5−3)=(1)(−1)(1.5)(−0.5)=−1−0.75=0.75 L2(2.5)=(3−1)(3−2)(2.5−1)(2.5−2)=(2)(1)(1.5)(0.5)=20.75=0.375Check sum: L0+L1+L2=−0.125+0.75+0.375=1.0.
Assemble:
f(2.5)=0(−0.125)+1(0.75)+8(0.375)=0+0.75+3.0=3.75 f(2.5)=3.75Appeared: 2019 Q.4(b) — (04 marks)
Full Answer:
Three points specify a unique quadratic curve. We construct the second-degree Lagrange interpolating polynomial through:
(x0,y0)=(2,7.2),(x1,y1)=(4.25,7.1),(x2,y2)=(5.25,6.0)At target x=4.00:
L0=(2−4.25)(2−5.25)(4−4.25)(4−5.25)=(−2.25)(−3.25)(−0.25)(−1.25)=7.31250.3125=0.04273504 L1=(4.25−2)(4.25−5.25)(4−2)(4−5.25)=(2.25)(−1)(2)(−1.25)=−2.25−2.5=1.11111111 L2=(5.25−2)(5.25−4.25)(4−2)(4−4.25)=(3.25)(1)(2)(−0.25)=3.25−0.5=−0.15384615Check: L0+L1+L2=0.04273504+1.11111111−0.15384615=1.00000000.
Assemble y(4.00):
y(4.00)=7.2(0.04273504)+7.1(1.11111111)+6.0(−0.15384615) y(4.00)=0.30769231+7.88888889−0.92307692=7.27350427 y(4.00)=7.2735 in.Appeared: 2021 Q.3(b) — (03 marks)
Full Answer:
| Comparison Factor | Newton's Interpolation | Lagrange's Interpolation |
|---|---|---|
| Mathematical form | Successive sum of difference terms | Single weighted sum of basis polynomials |
| Expansion basis | Divided differences or forward differences | Basis products ∏j=ixi−xjx−xj |
| Adding a new data node | Old work is retained; adds one new term | Must recompute all basis terms |
| Equally spaced nodes | Fast finite difference tables (h) | Works, but does not exploit equal spacing |
| Unequally spaced nodes | Requires divided differences | Natural and direct without difference table |
| Computational cost | O(n) after table setup | O(n2) direct evaluations |
| Position in table | Forward at start, backward at end | Symmetric across the whole interval |
Appeared: 2024 Q.2(c) — (04 marks)
Full Answer:
Description: Given n+1 distinct points (x0,y0),…,(xn,yn), there is a unique polynomial of degree at most n passing through all of them. Lagrange writes this polynomial directly as a linear combination of basis functions:
Pn(x)=i=0∑nyiLi(x),Li(x)=j=0j=i∏nxi−xjx−xjEach basis polynomial satisfies Li(xi)=1 and Li(xj)=0 for j=i. Thus, each term contributes yi at its own node and zero at all other nodes.
Advantages:
Disadvantages:
Appeared: CT-02A Q.1 — (04 marks)
Full Answer:
Given water pollutant concentration data:
| Distance x (km) | 2 | 4 | 7 | 10 |
|---|---|---|---|---|
| Concentration C (mg/L) | 18 | 26 | 43 | 60 |
The nodes are unequally spaced (x0=2,x1=4,x2=7,x3=10). We estimate C(5) using Lagrange's third-degree polynomial.
Compute the basis polynomials at x=5:
L0(5)=(2−4)(2−7)(2−10)(5−4)(5−7)(5−10)=(−2)(−5)(−8)(1)(−2)(−5)=−8010=−81=−0.125 L1(5)=(4−2)(4−7)(4−10)(5−2)(5−7)(5−10)=(2)(−3)(−6)(3)(−2)(−5)=3630=65≈0.833333 L2(5)=(7−2)(7−4)(7−10)(5−2)(5−4)(5−10)=(5)(3)(−3)(3)(1)(−5)=−45−15=31≈0.333333 L3(5)=(10−2)(10−4)(10−7)(5−2)(5−4)(5−7)=(8)(6)(3)(3)(1)(−2)=144−6=−241≈−0.041667Sum check:
L0+L1+L2+L3=−81+65+31−241=24−3+20+8−1=2424=1.0✓Estimate concentration at x=5 km:
P(5)=18(−81)+26(65)+43(31)+60(−241) P(5)=−2.25+21.6667+14.3333−2.5=31.25 mg/L C(5)=31.25 mg/L← Previous: NM-4.3 Non-Linear Regression | 🏠 Index | Next: NM-4.7 Newton's Forward Difference →