Explanation:
Using nodes X0 = 0, X1 = 31, and X2 = 32, we wish to construct a Lagrange polynomial of at most degree 2 for f(x).
P2(x) = L0(x) * f(0) + L1(x) * f(31) + L2(x) * f(32)
= L0(x) * 0 + L1(x) * (-1) + L2(x) * 0
= -L1(x)
= -x(x - 32)/[(31 - 0)(31 - 32)]
= x²/31 - (32/31)x.
Thus, f(21) ≈ P2(21) = 21²/31 - (32/31)(21) ≈ -7.452.
Theoretical error bound = |f'''(€)/3! * 21(21 - 31)(21 - 32)|
= |(π/2)³/6 * 21(21 - 31)(21 - 32)|
≈ 1492.18.
Actual value of f(21) = 1.
Since 1 - (-7.452) ≤ 1492.18, we have verified the result.