For the four data points (1,2),(2,3),(3,5),(4,4), set up and solve the normal equations for the line y=β0+β1x. What are the residual sum of squares and the unbiased noise-variance estimate σ^2?

Supervised learning, Linear regression
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can carry the normal equations through with numbers and use σ^2=RSS/(n−p).

Key idea

Solve (X⊤X)β^=X⊤y with X having a column of ones. The unbiased variance estimate divides by n−p (here 4−2=2), not by n.

Steps

  1. Build X with rows (1,xi). Then X⊤X=(4101030) (sums of 1, x, x2) and X⊤y=(14,39)⊤ (sums of y and xy).
  2. The determinant is 4⋅30−100=20, so β^=120(30−10−104)(1439)=120(30,16)⊤=(1.5,0.8)⊤.
  3. So the line is y^=1.5+0.8x. Fitted values at x=1,2,3,4 are 2.3,3.1,3.9,4.7.
  4. Residuals are −0.3,−0.1,1.1,−0.7, which sum to 0 (as they must with an intercept).
  5. RSS=0.09+0.01+1.21+0.49=1.8.
  6. σ^2=1.8/(4−2)=0.9. We divide by n−p because two degrees of freedom were used up fitting β0 and β1.

Common mistakes

How long your answer should be

Half a page, 4–5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: Four observations are x=1.5, 2, 4, 7. What is the estimated density at x=3 using (a) a box kernel of width 2h=4, that is K(u)=12 for ∣u∣≤1 with h=2, and (b) a Gaussian kernel with h=1?
Next in Supervised learning: Run the perceptron algorithm with learning rate 1, starting from w=(0,0) and b=0, on the points (2,1) with label +1, (1,−1) with +1, (−1,0) with −1 and (0,2) with −1, in this order. A point counts as a mistake if y(w⊤x+b)≤0. What are the weights after each update, and when does it stop?