← 2016 Paper 2

UPSC 2016 Maths Optional Paper 2 Q6c — Step-by-Step Solution

20 marks · Section B

Lagrange's interpolation · Numerical Analysis · asked 5× in 13 yrs · Read the full method →

Question

Let f(x)=e2xcos3xf(x)=e^{2x}\cos 3x, for x[0,1]x\in[0,1]. Estimate the value of f(0.5)f(0.5) using Lagrange interpolating polynomial of degree 3 over the nodes x=0, x=0.3, x=0.6x=0,\ x=0.3,\ x=0.6 and x=1x=1. Also, compute the error bound over the interval [0,1][0,1] and the actual error E(0.5)E(0.5).

Technique

Cubic Lagrange interpolation on four nodes; basis values at 0.50.5 (check Li=1\sum L_i=1); standard remainder E=f(4)(ξ)4!W(x)E=\frac{f^{(4)}(\xi)}{4!}W(x); bound f(4)|f^{(4)}| by recognising the constant-amplitude form e2x(120sin3x119cos3x)e^{2x}(120\sin3x-119\cos3x) with amplitude 169169.

Solution

Setup. Four nodes x0=0, x1=0.3, x2=0.6, x3=1x_0=0,\ x_1=0.3,\ x_2=0.6,\ x_3=1 give a degree-33 Lagrange polynomial

P3(x)=i=03f(xi)Li(x),Li(x)=jixxjxixj.P_3(x)=\sum_{i=0}^{3}f(x_i)\,L_i(x),\qquad L_i(x)=\prod_{j\neq i}\frac{x-x_j}{x_i-x_j}.

Step 1 — Node values of f(x)=e2xcos3xf(x)=e^{2x}\cos 3x

xix_ie2xie^{2x_i}cos3xi\cos 3x_if(xi)f(x_i)
0.00.01.0000001.000000cos0=1.000000\cos 0=1.0000001.0000001.000000
0.30.31.8221191.822119cos0.9=0.621610\cos 0.9=0.6216101.1326431.132643
0.60.63.3201173.320117cos1.8=0.227202\cos 1.8=-0.2272020.754338-0.754338
1.01.07.3890567.389056cos3=0.989992\cos 3=-0.9899927.315129-7.315129

Step 2 — Evaluate the Lagrange basis at x=0.5x=0.5

With x=0.5x=0.5, the denominators are ji(xixj)\prod_{j\neq i}(x_i-x_j) and the numerators ji(0.5xj)\prod_{j\neq i}(0.5-x_j):

L0(0.5)=(0.50.3)(0.50.6)(0.51)(00.3)(00.6)(01)=(0.2)(0.1)(0.5)(0.3)(0.6)(1)=0.010.18=0.055556,L_0(0.5)=\frac{(0.5-0.3)(0.5-0.6)(0.5-1)}{(0-0.3)(0-0.6)(0-1)}=\frac{(0.2)(-0.1)(-0.5)}{(-0.3)(-0.6)(-1)}=\frac{0.01}{-0.18}=-0.055556, L1(0.5)=(0.5)(0.1)(0.5)(0.3)(0.3)(0.7)=0.0250.063=0.396825,L_1(0.5)=\frac{(0.5)(-0.1)(-0.5)}{(0.3)(-0.3)(-0.7)}=\frac{0.025}{0.063}=0.396825, L2(0.5)=(0.5)(0.2)(0.5)(0.6)(0.3)(0.4)=0.050.072=0.694444,L_2(0.5)=\frac{(0.5)(0.2)(-0.5)}{(0.6)(0.3)(-0.4)}=\frac{-0.05}{-0.072}=0.694444, L3(0.5)=(0.5)(0.2)(0.1)(1)(0.7)(0.4)=0.010.28=0.035714.L_3(0.5)=\frac{(0.5)(0.2)(-0.1)}{(1)(0.7)(0.4)}=\frac{-0.01}{0.28}=-0.035714.

(Sum =1=1, a useful check. ✓)

Step 3 — The estimate P3(0.5)P_3(0.5)

P3(0.5)=f(xi)Li(0.5)P_3(0.5)=\sum f(x_i)L_i(0.5) =(1)(0.055556)+(1.132643)(0.396825)+(0.754338)(0.694444)+(7.315129)(0.035714)=(1)(-0.055556)+(1.132643)(0.396825)+(-0.754338)(0.694444)+(-7.315129)(-0.035714) =0.055556+0.4494610.523846+0.261254=0.131316.=-0.055556+0.449461-0.523846+0.261254=\boxed{0.131316.}

Step 4 — Error bound on [0,1][0,1]

The interpolation error is

E(x)=f(x)P3(x)=f(4)(ξ)4!W(x),W(x)=i(xxi), ξ(0,1).E(x)=f(x)-P_3(x)=\frac{f^{(4)}(\xi)}{4!}\,W(x),\qquad W(x)=\prod_{i}(x-x_i),\ \xi\in(0,1).

Differentiating f=e2xcos3xf=e^{2x}\cos 3x four times,

f(4)(x)=e2x(120sin3x119cos3x).f^{(4)}(x)=e^{2x}\big(120\sin 3x-119\cos 3x\big).

The bracket has amplitude 1202+1192=28561=169\sqrt{120^2+119^2}=\sqrt{28561}=169, so

f(4)(x)169e2x169e21248.75on [0,1].|f^{(4)}(x)|\le 169\,e^{2x}\le 169\,e^{2}\approx 1248.75\quad\text{on }[0,1].

Take M4=169e2M_4=169e^2. At x=0.5x=0.5, W(0.5)=(0.5)(0.2)(0.1)(0.5)=0.005=1200W(0.5)=(0.5)(0.2)(-0.1)(-0.5)=0.005=\tfrac{1}{200}, so the pointwise error bound at 0.50.5 is

E(0.5)M44!W(0.5)=169e22412000.260.|E(0.5)|\le\frac{M_4}{4!}\,|W(0.5)|=\frac{169e^{2}}{24}\cdot\frac{1}{200}\approx\boxed{0.260.}

(Over the whole interval, max[0,1]W(x)0.01755\max_{[0,1]}|W(x)|\approx0.01755, giving the uniform bound E169e224(0.01755)0.913|E|\le\frac{169e^2}{24}(0.01755)\approx0.913.)

Step 5 — Actual error E(0.5)E(0.5)

f(0.5)=e1cos1.5=2.718282×0.070737=0.192284.f(0.5)=e^{1}\cos 1.5=2.718282\times0.070737=0.192284. E(0.5)=f(0.5)P3(0.5)=0.1922840.131316=0.060968.E(0.5)=f(0.5)-P_3(0.5)=0.192284-0.131316=\boxed{0.060968.}

This respects the bound 0.0609680.2600.060968\le0.260. ✓

Verification

python3 (sympy / numpy):
  P₃(0.5) = 0.131316055                                            ✓
  f(0.5)  = e·cos1.5 = 0.192283650                                 ✓
  actual error E(0.5) = f − P₃ = 0.060967595                       ✓
  f⁽⁴⁾ = e^{2x}(120 sin3x − 119 cos3x),  amplitude √(120²+119²)=169 ✓
  max|f⁽⁴⁾| on [0,1] ≈ 998.3 (at x≈0.98) ≤ 169e² = 1248.75         ✓
  W(0.5)=1/200;  bound 169e²/(24·200)=0.2602 ≥ 0.0610              ✓
  max|W| on [0,1] ≈ 0.017546                                       ✓
We post more of this — worked solutions, CSAT trap breakdowns, guide chapters — a few times a week on Telegram. Free, no sign-in. Join

This solution is part of the Maths Coverage Map — 13 years, mapped. Get the take-away PDF free.