The regression line should be drawn on the scatter diagram in such a way that when the squared values of the vertical distance from each plotted point to the line are added, the total amount will be the smallest possible amount. This criterion is called the Method of Least Squares.
Minimizing the sum of the squared differences of each value of Y from the regression line by the method of calculus, we arrive at two equations, called the normal equations:
Solving these equations simultaneously, and using equivalent expressions for and , we obtain the following formulae used to calculate the coefficients a and b in the regression line = = a + bX
E(Y|X = x) = a + bx