Predict a scalar from a feature: y^=wx+b\hat y = w x + by^=wx+b. Choose w,bw, bw,b to minimise the mean squared error:
Closed form: w^=(X⊤X)−1X⊤y\hat w = (X^\top X)^{-1} X^\top yw^=(X⊤X)−1X⊤y. Drag the sliders; the yellow rays are residuals — their squared lengths sum to the MSE.