Least squares is the name of a procedure in mathematics, to construct a function from a number of observed values. The basic idea is to construct the function in such a way that the sum of the difference between the observed value and its data point is minimized. Since the difference may go in either direction, the value of the difference is squared, for each value.