Least Squares

Points P(1) through P(6) represent data points. A line is drawn through the points, and from each data point to the line a square is constructed. Drag the y-intercept and slope of the line so that the sum of the areas of the squares is minimized. That line is the least squares regression line for the data.