M8MATH-10.2

Fitting a Line to a Scatter Plot

Learn how to fit a line to a scatter plot by eye, judge how well it fits, and write the equation using two points on the line.

What you'll do in this lesson

A voice-first session with the Crimsora tutor on Fitting a Line to a Scatter Plot, then targeted practice and FRQs — with the tutor adapting to where you get stuck.

What this lesson covers

When you see a scatter plot that looks roughly linear, you might want to draw a line that represents the overall trend. This is called fitting a line to the data. In this lesson, you will learn how to draw a line by eye, decide if your line is a good fit, and find the equation of that line using two points. This skill helps you make predictions and understand the relationship between two variables.

Understanding What It Means to Fit a Line

Fitting a line to a scatter plot means drawing a straight line through the data in a way that captures the general trend. You are not trying to connect the dots or pass through every point—that would be impossible if the points don't lie exactly on a line. Instead, you want a line that represents the overall pattern.

Think of a fitted line as a summary: it shows which direction the data tends to go and how strongly two variables are related. If all points lie perfectly on your line, the relationship is perfect. More often, points scatter around the line because real-world data includes variation and measurement error.

When you fit a line by eye (called informal fitting), you are making a judgment call about what line looks fairest. This is different from using a formula (like least-squares regression), which you may study later. For now, you rely on your visual sense of balance and reasonableness.

How to Fit a Line and Judge Its Fit

To fit a line by eye, follow these steps:

Choose a direction. Look at the scatter plot. Do the points trend upward from left to right, downward, or roughly flat? Your line should go that direction.

Balance the points. The key test is this: about as many points should lie above the line as below it. If most points cluster on one side, your line is off.

Check vertical gaps. Look at the vertical distance from each point to the line (called the residual). These gaps should be small and scattered roughly evenly on both sides. If one side has large gaps and the other has small gaps, adjust your line.

Redraw if needed. It often takes a few tries. Move your line slightly until the fit looks balanced.

A good fit does not mean every point touches the line. It means the line represents the trend fairly and the leftover distances (residuals) are small and balanced. When you look at your final line, no side of it should obviously have more or larger gaps than the other.

Writing the Equation of Your Fitted Line

Once you have drawn your line, you need to find its equation in the form y=mx+by = mx + b, where mm is the slope and bb is the yy-intercept.

Step 1: Identify two clear points on your line. These should not be original data points—they should be points where your drawn line passes. Choose points that are far apart (far apart points give less rounding error).

Step 2: Calculate the slope. Use m=riserun=y2y1x2x1m = \frac{\text{rise}}{\text{run}} = \frac{y_2 - y_1}{x_2 - x_1} with your two points.

Step 3: Find the yy-intercept. Either read bb directly from the graph (where the line crosses the yy-axis) or substitute one point and the slope into y=mx+by = mx + b and solve for bb.

Step 4: Write the equation. Plug mm and bb into y=mx+by = mx + b.

Always pick points on your drawn line, not points from the original data scatter. This ensures you are writing the equation of the line you actually fitted, not a formula based on scattered data points.

Common Errors and Misconceptions

Error 1: Forcing the line through data points. Students often try to make the line pass through as many original data points as possible. This defeats the purpose of fitting. Your line is allowed to have data points above and below it.

Error 2: Unbalanced fit. Beginners sometimes draw a line that clearly has many points on one side and few on the other. This happens when you focus on just one or two extreme points instead of looking at the whole scatter.

Error 3: Using data points to write the equation. The slope calculated from two data points is usually not the slope of your fitted line. Always use two points that lie on your drawn line.

Error 4: Ignoring outliers. If one point sits far from the general trend, don't let it pull your line toward it. A good fit balances the bulk of the data, not individual outliers.

Error 5: Forgetting the purpose. A fitted line is a tool for understanding and predicting, not a perfect model. Real data has noise. Accept small, balanced residuals as a sign of a good fit.

Key terms

Fitting a line.
Drawing a straight line through a scatter plot that represents the overall trend, with roughly equal numbers of points above and below and small balanced vertical distances.
Slope (mm).
The rate of change of a line, calculated as m=riserun=y2y1x2x1m = \frac{\text{rise}}{\text{run}} = \frac{y_2 - y_1}{x_2 - x_1}, telling you how much yy changes when xx increases by 1.
yy-intercept (bb).
The yy-coordinate where a line crosses the yy-axis, found by setting x=0x = 0 in the equation y=mx+by = mx + b.
Residual.
The vertical distance from a data point to the fitted line, showing how far the actual value is from the value predicted by the line.
Linear relationship.
A pattern in data where two variables are related by a straight-line trend, suggesting one variable tends to increase or decrease steadily as the other changes.
Informal fitting.
Fitting a line to data by eye and judgment rather than using a mathematical formula or statistical procedure.

Worked example

The table below shows the relationship between hours studied and test score for 8 students. Plot the points, fit a line by eye, and write its equation.
Hours StudiedTest Score
162
268
375
478
585
688
792
896
Step 1: Plot the points. Plot each pair on a coordinate grid with hours on the xx-axis (horizontal) and test score on the yy-axis (vertical). The points will show a clear upward trend from lower left to upper right.

Step 2: Fit a line by eye. Look at the scatter. The trend is strongly positive (upward). Draw a line that goes through the middle of the cloud. Check: Are there roughly equal points above and below? Yes—about 3–4 points above, 3–4 points below, and one or two near the line. The vertical gaps on both sides look small and balanced. This is a good fit.

Step 3: Identify two clear points on your line. Your drawn line might pass through or very near the points (1, 62) and (8, 96). You could use these, or you might use other points on the line if it does not pass exactly through data points. Let's use (1, 62) and (8, 96).

Step 4: Calculate the slope.m=966281=3474.86m = \frac{96 - 62}{8 - 1} = \frac{34}{7} \approx 4.86Or in exact form, m=347m = \frac{34}{7}.

Step 5: Find the yy-intercept. Substitute (1,62)(1, 62) and m=347m = \frac{34}{7} into y=mx+by = mx + b:62=347(1)+b62 = \frac{34}{7}(1) + b62=347+b62 = \frac{34}{7} + bb=62347=4347347=400757.14b = 62 - \frac{34}{7} = \frac{434}{7} - \frac{34}{7} = \frac{400}{7} \approx 57.14Or in decimal form, b57.1b \approx 57.1.

Step 6: Write the equation. Using exact fractions: y=347x+4007y = \frac{34}{7}x + \frac{400}{7}

Using decimals: y4.86x+57.1y \approx 4.86x + 57.1

You could also write it as y4.9x+57y \approx 4.9x + 57 if rounding to simpler numbers. Either form is acceptable as long as it matches your fitted line.

Practice questions

The scatter plot below shows the age (in years) and height (in centimeters) of 10 children. A line has been drawn to fit the data. Two points on the fitted line are (4, 105) and (12, 150). Which equation best represents the fitted line?
  1. y=5.625x+82.5y = 5.625x + 82.5
  2. y=5.625x+77.5y = 5.625x + 77.5
  3. y=45x+10y = 45x + 10
  4. y=0.18x+104y = 0.18x + 104

Answer: y=5.625x+82.5y = 5.625x + 82.5

First, find the slope using the two given points on the fitted line:m=150105124=458=5.625m = \frac{150 - 105}{12 - 4} = \frac{45}{8} = 5.625Now substitute one point, say (4, 105), into y=mx+by = mx + b:105=5.625(4)+b105 = 5.625(4) + b105=22.5+b105 = 22.5 + bb=82.5b = 82.5So the equation is y=5.625x+82.5y = 5.625x + 82.5. A common error is using the rise and run incorrectly, or picking data points instead of points on the fitted line, which would give a different answer.
A student plotted 6 data points and drew a fitted line. After drawing the line, she counts 5 points above the line and 1 point below it. What should she do?
  1. Accept the fit because the line passes through most of the points.
  2. Redraw the line to achieve a more balanced fit with roughly equal points above and below.
  3. Erase the point that is alone below the line.
  4. Move the line up so all points are below it.

Answer: Redraw the line to achieve a more balanced fit with roughly equal points above and below.

A key criterion for a good visual fit is that roughly as many points lie above the line as below it. If 5 are above and only 1 is below, the fit is not balanced. The student should adjust the line slightly downward or rightward to bring it into better balance. Erasing a point or forcing all points to one side violates the principle of fitting. A good fit balances the residuals, not the number of points it touches.
You draw a fitted line on a scatter plot of temperature versus ice cream sales. You identify two points on your drawn line: (45, 120) and (75, 180). Write the equation of your line in the form y=mx+by = mx + b.

Answer: y=2x+30y = 2x + 30

Using the slope formula with the two points on the line:m=1801207545=6030=2m = \frac{180 - 120}{75 - 45} = \frac{60}{30} = 2Substitute into y=mx+by = mx + b using (45, 120):120=2(45)+b120 = 2(45) + b120=90+b120 = 90 + bb=30b = 30The equation is y=2x+30y = 2x + 30. This means for every degree increase in temperature, ice cream sales increase by 2 units, and when temperature is 0, the model predicts 30 units of sales (though this extrapolation may not be realistic).

FAQ

Do the data points have to lie exactly on the fitted line?
No. In fact, most of them will not. A fitted line represents the trend of the data, not every individual point. As long as the points are roughly balanced above and below the line with small and even vertical gaps, the fit is good. The whole point of fitting is to summarize a noisy pattern.
How do I know which two points to use to write the equation?
Pick two points that lie on your drawn line (not the original data points), and choose points that are far apart. Points far apart reduce rounding error when you calculate the slope. You can use the yy-intercept as one of your points if it is clearly marked on your graph. Avoid picking points that are very close together.
What should I do if my line looks good but doesn't pass through any original data points?
That is perfectly fine and actually very common. Your fitted line is based on the overall trend, not on individual points. Write the equation using two clear points on your drawn line, whether or not they are data points from the original scatter plot.
How do I judge whether a fitted line is better than another?
Compare how balanced the residuals (vertical distances) are. A better fit has roughly equal numbers of points above and below, with small and scattered gaps. A worse fit has gaps that are larger, uneven (bigger on one side), or clustered in one region. You can also think about which line seems to split the cloud of points most fairly down the middle.

Learn this with a teacher, not a page

The Crimsora tutor teaches Fitting a Line to a Scatter Plot live — explaining on a whiteboard, asking you questions, and adapting to where you get stuck.