The least squares method is a widely used technique for computing regression coefficients, that is, fitting a model to observed data. The goal in regression is to choose coefficients that minimize the fitting error. A common way to measure error is to sum the squares of the
Residuals (the differences between observed and predicted values at the original data points). Minimizing this sum leads to the least squares method.