Linear Regression illustration

The GeoGebra worksheet below illustrates linear regression for six data points. Initially, the data points all lie on a single line, and the regression line goes right through them. It is a standard exercise to find the equation of a line through two points, so there is nothing new here. However, when you click and drag the points, the regression line will change but will always be the "best fit" to the data points.

Sorry, the GeoGebra Applet could not be started. Please make sure that Java 1.4.2 (or later) is installed and active in your browser (Click here to install Java now)

Here are the commands needed to make this illustration. Enter them one by one in the Input box.
P=(1,1)
Q=(2,2)
R=(3,3)
S=(4,4)
T=(5,5)
U=(6,6)
A = {P, Q, R, S, T, U}
L = FitLine[A]
Options, Rounding, 5 decimal places

Craig L. Zirbel, Created with GeoGebra