The method of least squares is used to estimate parameters in statistical models such as those that occur in regression. Estimates for the parameters are obtained by minimizing the sum of the squares of the differences between the observed values and the predicted values under the model. For example, suppose that, in a case of linear regression, where Y = α + βX + ε, there are n paired observations (x1,y1), (x2,y2),…, (xn,yn). Then the method of least squares gives a and b as estimators for α and β, where a and b are chosen so as to minimize e(a,b) = ∑ (yk−a−bxk)2. Solving the simultaneous equations ∂e/∂a = 0 = ∂e/∂b gives
and , where and denote the means of the xk and yk respectively.