Linear Regression illustration

This GeoGebra worksheet allows you to control the line of best fit by means of two sliders giving the intercept (c) and the slope (m). The idea is to find a line that gives a "best" fit to the data. The "residuals" are defined as the distance in the y direction between the data and this fitted line. The residuals are denoted by green vectors. The aim is to find a line fit that has the smallest possible sum of squares of these residuals. In order to help you, the squares of the residuals are drawn on the page, and the sum of squares is given in a box. This best fit is defined as the smallest possible sum of the squares of the residuals.