Fit the points (0,1),(1,3),(2,3) with (a) a quadratic y=a+bx+cx2 and (b) a straight line. Find each fit and its residual sum of squares. Why is the quadratic exact, and what goes wrong if you try a cubic?

Supervised learning, Basis-function regression
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Polynomial regression is linear regression on the basis (1,x,x2,… ). Exact interpolation occurs when the number of parameters equals the number of distinct points.

Key idea

Polynomial regression uses the design matrix with columns 1,x,x2,…. With n distinct points, a degree n−1 polynomial fits exactly, and degree ≥n makes X⊤X singular.

Steps

  1. Quadratic: the three equations are a=1, a+b+c=3, a+2b+4c=3. With a=1: b+c=2 and 2b+4c=2, so b+2c=1. Subtracting, c=−1 and b=3. So y=1+3x−x2, with RSS =0.
  2. Line: xˉ=1, yˉ=7/3, Sxy=(−1)(1−7/3)+(1)(3−7/3)=4/3+2/3=2, Sxx=2. Slope =1, intercept =7/3−1=4/3.
  3. Line fitted values 4/3,7/3,10/3; residuals −1/3,2/3,−1/3; RSS =(1+4+1)/9=2/3.
  4. Why exact: the 3×3 Vandermonde matrix with rows (1,xi,xi2) has determinant ∏i<j(xj−xi)=1⋅2⋅1=2≠0, so it is invertible and the system has a unique solution.
  5. Cubic: there are 4 unknowns and 3 equations, so X is 3×4 with rank 3 and X⊤X (4×4) is singular. There are infinitely many cubics through the points. Regularisation (ridge) or a lower degree is needed.
  6. Lesson: zero training error with n parameters means the model is interpolating (including noise), so choose the degree by cross-validation.

Common mistakes

How long your answer should be

Half a page, 5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: For K-class softmax regression with P(y=k∣x)=ewk⊤x/∑jewj⊤x, derive the gradient of the negative log-likelihood with respect to wk. How do you show that the parameters are redundant (not identifiable), and how is this fixed?
Next in Supervised learning: The elastic net minimises ∥y−Xβ∥2+λ2∥β∥22+λ1∥β∥1. How do you show that it is a lasso problem on augmented data, and what does this imply for the number of variables it can select and for correlated features?