Line of Best Fit
By the end of this lesson, you’ll be able to:
- Understand what a line of best fit represents.
- Estimate slope and intercept from a scatterplot.
- Select an equation that matches a line of best fit.
- Make predictions using the line.
- Interpret slope and intercept in context.
- Use Desmos to generate a regression line.
Key Ideas
A line of best fit (also called a trend line) summarizes the overall pattern in a scatterplot.
It represents the linear relationship between two variables and can be used to make predictions.
A line of best fit:
- Shows the overall trend in the data
- Smooths out random variation
- Helps estimate future values
- Provides a mathematical model for the relationship
The equation of a line of best fit is typically written as:
\[ \hat{y} = mx + b \]
where:
- \(m\) is the slope
- \(b\) is the y-intercept
- \(\hat{y}\) is the predicted value of \(y\)

A line of best fit is most useful when the scatterplot shows a clear linear trend.
If the data are widely scattered or follow a curved pattern, a linear model may not be appropriate.
Common Problem Types
Estimating Slope From the Line
To estimate the slope, choose two clear points on the line of best fit, not individual data points.
Example
Suppose the line passes through:
\[ (2,10) \]
and
\[ (6,18) \]
Then:
\[ m=\frac{18-10}{6-2} =\frac{8}{4} =2 \]
The slope is:
\[ 2 \]
Identifying the Intercept
The y-intercept is the point where the line crosses the y-axis.
Example
If the line crosses the y-axis at:
\[ (0,4) \]
then the intercept is:
\[ 4 \]
Predicting Values
Use the equation of the line to predict values.
Example
Suppose:
\[ \hat{y}=3x+2 \]
Predict \(y\) when:
\[ x=5 \]
Substitute:
\[ \hat{y}=3(5)+2 \]
\[ \hat{y}=17 \]
The prediction is:
\[ 17 \]
Selecting an Equation for the Line of Best Fit
Many math questions ask which equation best represents the line shown on a scatterplot.
Estimate:
- the slope
- the y-intercept
Then choose the equation that most closely matches those values.
Example
Suppose a line appears to have:
\[ m \approx 2 \]
and
\[ b \approx 5 \]
A reasonable model would be:
\[ \hat{y}=2x+5 \]
You do not need exact values.
It is often expected for students to estimate the slope and intercept from the graph.
Using Desmos to Generate a Line of Best Fit
Desmos can create a regression model directly from a table of data.
Step 1: Enter the Data
Create a table and enter the data points.

Step 2: Create the Regression Model
Below the table, type:
y_1 ~ mx_1 + b
Desmos automatically computes the line of best fit and estimates the values of \(m\) and \(b\).

The symbol ~ tells Desmos to perform a regression rather than graph an equation.
Desmos will automatically determine the values of the parameters that best fit the data.
Interpreting the Results
Suppose Desmos reports:
\[ m=2.1 \]
and
\[ b=5.3 \]
Then the regression equation is approximately:
\[ \hat{y}=2.1x+5.3 \]
The slope represents the average change in \(y\) for each 1-unit increase in \(x\).
The intercept represents the predicted value of \(y\) when:
\[ x=0 \]
The line of best fit shown on a graph may not exactly match a regression equation generated by technology.
Always answer the question using the information provided.
Interpreting Slope in Context
The slope tells how much the predicted value of \(y\) changes when \(x\) increases by 1 unit.
Example
Suppose:
\[ m=0.8 \]
If:
- \(x\) = hours studied
- \(y\) = test score
then:
Each additional hour studied is associated with an increase of about 0.8 points in the predicted test score.
Always include units when interpreting slope.
Extrapolation (Use With Caution)
Extrapolation means making predictions outside the range of observed data.
This can be risky because the trend may not continue.
Example
Suppose data were collected for ages:
\[ 10 \le x \le 18 \]
Using the model to predict a value at:
\[ x=50 \]
would be extrapolation.
The prediction may not be reliable.
Strategies
- Use points on the line, not points from the data cloud.
- Estimate slope before looking at answer choices.
- Read the y-intercept directly from the graph.
- Include units when interpreting slope and intercept.
- Use predictions only within a reasonable range of the data.
- Be cautious when extrapolating.
Worked Examples
Example 1
A line of best fit passes through:
\[ (0,5) \]
and
\[ (4,13) \]
Find the equation of the line.
Solution
Slope:
\[ m=\frac{13-5}{4-0} =\frac{8}{4} =2 \]
Intercept:
\[ b=5 \]
Equation:
\[ \hat{y}=2x+5 \]
Example 2
Using:
\[ \hat{y}=2x+5 \]
predict the value of \(y\) when:
\[ x=10 \]
Solution
\[ \hat{y}=2(10)+5 \]
\[ \hat{y}=25 \]
Prediction:
\[ 25 \]
Example 3
A line of best fit has slope:
\[ 0.4 \]
and models hours studied versus test score.
Interpret the slope.
Solution
Each additional hour studied is associated with an increase of about 0.4 points in the predicted test score.
Common Mistakes
- Choosing random data points instead of points on the line.
- Ignoring units when interpreting slope.
- Misreading the graph scale.
- Assuming every scatterplot has a strong linear relationship.
- Using extrapolation far outside the observed data range.
Practice Problems
A line passes through \((1,4)\) and \((3,10)\). Find the slope.
A line crosses the y-axis at 7. What is the intercept?
If
\[ \hat{y}=1.5x+2 \]
predict \(y\) when:
\[ x=8 \]
- Interpret a slope of:
\[ 0.4 \]
in the context of hours studied versus test score.
- A line appears to have slope 3 and y-intercept 4. Which equation best models the relationship?
Solutions
1
\[ m=\frac{10-4}{3-1} =\frac{6}{2} =3 \]
2
\[ 7 \]
3
\[ 1.5(8)+2 =12+2 =14 \]
4
Each additional hour studied is associated with an increase of about 0.4 points in the predicted test score.
5
\[ \hat{y}=3x+4 \]
Summary
- A line of best fit summarizes a linear trend.
- Slope represents the rate of change.
- The y-intercept represents the predicted value when \(x=0\).
- Predictions come from substituting values into the equation.
- Math prep questions often require estimating slope and intercept from a graph.
- Desmos can generate regression models using tables and regression syntax.
- Use points on the line, not the scatterplot.
- Slope = rate of change.
- Intercept = starting value.
- Estimate before looking at answer choices.
- Avoid extreme extrapolation.