How do you show that if you only have two data points $(x_1, y_1)$ and $(x_2,y_2)$ then the best fit line given by the method of least squares is the line through $(x_1,y_1)$ and $(x_2,y_2)$

  • $\begingroup$ Simple: the residuals are zero for the best fit line, and zero is the smallest sum you can get with the residuals. $\endgroup$ – Parcly Taxel Mar 13 '18 at 6:08

If $x_1 \ne x_2$, then we can construct a line linking them and since the points lie on the line, there is no error.

However, precaution is the case where $x_1 = x_2$. In that case we want to minimize $$(\hat{y}-y_1)^2+(\hat{y}-y_2)^2$$

and the minimal is attain as long as $\hat{y}= \frac{y_1+y_2}2$, that is the best fit line has to passes through $(x_1, \frac{y_1+y_2}2)$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.