Fitting a Line to Data

On this web page you will fit lines to data points. This exploration will help you understand the concepts in Lesson 3.3 of Discovering Advanced Algebra: An Investigative Approach.


This sketch shows ten data points and a line. You can drag points S and T to change the line. If you press Fit Data Using Rectangle, you'll see a different line and a rectangle, both of which are adjustable. You can also drag the data points or press the Second Data Set button to get a different data set.

Sorry, this page requires a Java-compatible web browser.


  1. Drag S and T until the line is a good fit to the data. Half of the data points should be on each side of the line.
  2. For a different approach, press Fit Data Using Rectangle to show the rectangle. Move the corners of the rectangle so that it is as small as you can make it while still containing all of the data points. Now move points P and Q to make this second line of fit go through the rectangle parallel to the longer sides.
  3. Press Compare Lines to make the first line of fit reappear.
  4. How close are the lines? Which do you think is a better fit? Explain.
  5. Press Second Data Set and repeat the four steps above.
  6. Which method of finding a line of fit do you prefer? Why?
  7. How could you find an equation of either line of fit?
  8. What's an example of a real-life situation in which you might want a line of fit? Explain.