NivaarExam PrepOfficial exam papers ↗

04-BS-5 · May 2013

Question 4 of 7: Least-Squares Parabola and Lagrange Interpolation

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Exams — May 2013 — 04-BS-5 Advanced Mathematics. Three-hour, closed-book exam (one double-sided 8.5"×11" aid sheet permitted; approved Casio/Sharp calculator allowed). Format: seven questions of equal value (20 marks each); any five constitute a complete paper and only the first five appearing in the answer book are marked. All seven are solved below for completeness.

Reference texts: Kreyszig, Advanced Engineering Mathematics (10th ed., Wiley) — power-series solutions of ODEs (Ch. 5), Fourier series and the Fourier transform (Ch. 11), least-squares curve fitting, Lagrange interpolation, Romberg integration and root-finding (Ch. 19); Strang, Introduction to Linear Algebra (6th ed., Wellesley-Cambridge) — the Cayley–Hamilton theorem and matrix inversion.

Question 4: Least-Squares Parabola and Lagrange Interpolation (A) 10, (B) 10 marks

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. (A) A least-squares model $y=\alpha x+\beta x^2$ (no constant term) and $n$ data points $(x_i,y_i)$. (B) Four tabulated values of a quadratic function $f$ (table below).

Given data (Part B)
$x$-2124
$F(x)$11-4335

Find. (A) Derive $\alpha,\beta$ that minimize the sum of squared residuals. (B) The 2nd-degree Lagrange polynomial through the first three points, then check it against the fourth.

Approach. (A) Differentiate the sum of squares w.r.t. $\alpha,\beta$, set both to zero (normal equations), solve the resulting $2\times2$ linear system by Cramer's rule. (B) Build the Lagrange basis polynomials for the first three $x$-values and combine.

  1. (A) Form the sum of squared residuals and differentiate. $$S=\sum_{i=1}^n(y_i-\alpha x_i-\beta x_i^2)^2$$ $$\frac{\partial S}{\partial\alpha}=-2\sum x_i(y_i-\alpha x_i-\beta x_i^2)=0,\qquad\frac{\partial S}{\partial\beta}=-2\sum x_i^2(y_i-\alpha x_i-\beta x_i^2)=0$$
  2. (A) Rearrange into the normal equations. $$\alpha\sum x_i^2+\beta\sum x_i^3=\sum x_iy_i,\qquad\alpha\sum x_i^3+\beta\sum x_i^4=\sum x_i^2y_i$$
  3. (A) Solve the $2\times2$ system by Cramer's rule. With $D=\big(\sum x_i^2\big)\big(\sum x_i^4\big)-\big(\sum x_i^3\big)^2$: $$\boxed{\alpha=\dfrac{\big(\sum x_i^4\big)\big(\sum x_iy_i\big)-\big(\sum x_i^3\big)\big(\sum x_i^2y_i\big)}{D}},\qquad\boxed{\beta=\dfrac{\big(\sum x_i^2\big)\big(\sum x_i^2y_i\big)-\big(\sum x_i^3\big)\big(\sum x_iy_i\big)}{D}}$$ matching the printed formulas exactly (all sums run $i=1$ to $n$). $\blacksquare$
  4. (B) Write the Lagrange quadratic through $(-2,11),(1,-4),(2,3)$. $$L(x)=11\cdot\frac{(x-1)(x-2)}{(-2-1)(-2-2)}+(-4)\cdot\frac{(x+2)(x-2)}{(1+2)(1-2)}+3\cdot\frac{(x+2)(x-1)}{(2+2)(2-1)}$$
  5. (B) Expand and simplify. $$L(x)=\frac{11(x-1)(x-2)}{12}+\frac{4(x^2-4)}{3}+\frac{3(x+2)(x-1)}{4}=\boxed{3x^2-2x-5}$$ (Check: $L(-2)=11,\ L(1)=-4,\ L(2)=3$ ✓ — reproduces all three data points exactly.)
  6. (B) Check against the fourth point. $$L(4)=3(16)-2(4)-5=48-8-5=\boxed{35}$$ which equals $F(4)=35$ exactly — since all four tabulated values happen to lie on a single quadratic, the check point confirms $L(x)$ recovers the underlying function exactly, not merely a nearby approximation.
QuantityResult
Normal equations$\alpha\sum x^2+\beta\sum x^3=\sum xy$; $\alpha\sum x^3+\beta\sum x^4=\sum x^2y$
$L(x)$$3x^2-2x-5$
Check: $L(4)$$35=F(4)$ ✓