A line of best fit is a straight line drawn through a scatter plot that shows the overall trend of the data as closely as possible. It passes through the middle of the points, with about as many above it as below. Its equation, ŷ = mx + b, lets you predict one variable from the other.
In Spanish
recta de mejor ajuste
Also called
trend line, best-fit line, regression line, least-squares line, line of fit
The line misses most points, but the misses (the residuals) balance out. Its slope, about 4.6, says each extra hour of study goes with about 4.6 more points.
Formal definition and notation
For paired data(x1, y1), …, (xn, yn) with a linear pattern, a line of best fit is a line ŷ = mx + b that keeps the residuals yi − ŷi small. The least-squares regression line is the one that minimizes the sum of squared residuals; its slope is m = Σ (xi − x)(yi − y)Σ (xi − x)2, and it passes through (x, y).
Symbol
Read it as
Meaning
ŷ
y hat
the predicted value of y from the line, not an actual data value
y − ŷ
y minus y hat
a residual: how far a real point is above (+) or below (−) the line
(x, y)
x bar, y bar
the point of means; the least-squares line always goes through it
Key facts
Eyeball method: lay a ruler along the trend so the points are balanced on both sides, then find the equation from two points on the line (not necessarily data points).
A rising line means a positive association; a falling line means a negative association.
Interpolation (predicting inside the data’s x-range) is fairly safe. Extrapolation far outside it can be badly wrong.
An outlier can pull the line toward itself, especially at the far left or right of the plot.
A line of best fit shows association, not cause: more hours studied goes with higher scores here, but the line alone does not prove why.
If the points curve or scatter with no trend, a straight line is the wrong model.
Equation of a line of best fit
Equation of a line of best fit
ŷ = mx + b
m
the slope: the predicted change in y for each 1-unit increase in x
b
the y-intercept: the predicted y when x = 0 (meaningful only if 0 is a sensible x)
ŷ
the predicted y-value
By hand, pick two points on your drawn line and use the slope formula. Calculators and the linear regression tool find the least-squares line exactly.
Line of Best Fit examples, step by step
Example 1: Make a prediction
Warm-up
A line of best fit for plant height (cm) against weeks is ŷ = 2.5x + 4. Predict the height at 6 weeks.
Find the least-squares line for the points (1, 2), (2, 3), (3, 5), (4, 6).
Means: x = 2.5 and y = 4.
Top sum: (−1.5)(−2) + (−0.5)(−1) = 3.5 and (0.5)(1) + (1.5)(2) = 3.5, so 7 in all.
Bottom sum: 2.25 + 0.25 + 0.25 + 2.25 = 5, so m = 75 = 1.4.
The line passes through (2.5, 4): b = 4 − 1.4 × 2.5 = 0.5.
Answer:ŷ = 1.4x + 0.5
Example 3: Residual and meaning
Test-style
For hours studied x and score y, the line of best fit is ŷ = 3x + 50. A student who studied 9 hours scored 81. Find the residual and interpret the slope.
Predicted score: ŷ = 3(9) + 50 = 77.
Residual: y − ŷ = 81 − 77 = 4. The student scored 4 points above the line’s prediction.
Slope 3: each additional hour of study is associated with about 3 more points, on average.
Answer: The residual is 4 points; the slope means about 3 more points per extra hour studied.
Common mistakes
✗ MistakeDrawing the line through the first and last data points.
✓ InsteadDraw the line through the middle of the whole cloud, balancing the points above and below it.
The end points can be unusual. A line of best fit summarizes all of the data, not two of them.
✗ MistakeUsing ŷ = 3x + 50 to predict the score for 40 hours of study: 170 points.
✓ InsteadOnly predict inside the range of the data (here about 1 to 10 hours).
Extrapolating far beyond the data assumes the trend keeps going forever, which real data rarely does. A test score cannot pass 100.
✗ MistakeResidual = ŷ − y.
✓ InsteadResidual = y − ŷ: actual minus predicted.
A positive residual means the point is above the line. Reversing the order flips every sign.
Correlation measures how tightly the points cluster around a line, with a numberr from −1 to 1. The line of best fit is the line itself, with a slope and intercept.
An exact linear equation is true for every point on it. A line of best fit is a model: real points sit above and below it, and ŷ is only a prediction.
Quick check: 3 questions
Question 1 of 3
The line of best fit for a car’s value (dollars) against age (years) is ŷ = −1800x + 24,000. What does −1800 mean?
Show answer and explanation
Answer: B. The slope is the predicted change in value for each additional year: about 1,800 dollars lost per year. The 24,000 dollars is the y-intercept, the predicted value of a new car.
Question 2 of 3
Using ŷ = 4x + 12, a point (5, 35) has what residual?
Show answer and explanation
Answer: B. Predicted ŷ = 4(5) + 12 = 32. Residual = 35 − 32 = 3: the point is 3 above the line. −3 subtracts in the wrong order, and 32 and 35 are the predicted and actual values.
Question 3 of 3
Which is the best description of a good line of best fit?
Show answer and explanation
Answer: C. A line of best fit follows the overall trend so that the points are balanced on both sides and the gaps are small. It may touch no points at all and need not pass through the origin.
Line of Best Fit: frequently asked questions
How do you find the line of best fit?
By eye: draw a straight line through the middle of the points with about as many above as below, pick two points on your line, and find the slope and y-intercept. Exactly: use the least-squares formulas or a calculator’s linear regression, which gives the line that makes the squared residuals as small as possible.
Does the line of best fit have to go through the origin?
No. It goes wherever the data trend goes, and its y-intercept is usually not 0. Only when the situation forces zero to give zero, like distance driven after zero hours, would you expect it to pass near the origin. The least-squares line always passes through the point of means, (x, y), instead.
What is the difference between a line of best fit and a regression line?
A line of best fit is any line drawn to match the trend, often by eye in middle school. The least-squares regression line is one specific line of best fit, the one that minimizes the sum of the squared residuals. Two students eyeballing a trend may draw slightly different lines; regression always gives the same one.
Updated November 2026·Reviewed by the Effortless Math team·Standards: CCSS 8.SP.A.2, CCSS 8.SP.A.3
Cite this entry
Effortless Math Team. “Line of Best Fit.” Effortless Math Dictionary. Updated November 2026. https://www.effortlessmath.com/math-dictionary/line-of-best-fit/
Flashcard
TermLine of Best Fittrend line on a scatter plot
DefinitionA straight line through the middle of a scatter plot that models the trend. Use ŷ = mx + b to predict y from x.
Scatter PlotA scatter plot displays paired numerical data as points on a coordinate plane, one point for each pair. It helps show whether two quantities have a pattern or relationship: points rising from left to right show a positive association, points falling show a negative association, and a shapeless cloud shows no association.Statistics · Grade 8, Algebra 1DataData are facts or values collected to answer a question, such as survey answers, measurements or counts. Numerical data are numbers you measure or count, like heights; categorical data are labels or groups, like favorite colors. Data are organized in tables and shown in graphs so patterns are easy to see.Statistics · Grade 2, Grade 3, Grade 6SlopeSlope is a number that measures how steep a line is: the change in y divided by the change in x between any two points on the line, often called rise over run. A positive slope rises from left to right, a negative slope falls, and a horizontal line has slope 0.Algebra · Grade 8, Algebra 1SideA side is one of the straight line segments that form the outline of a polygon. Two sides meet at each corner, or vertex. A triangle has 3 sides and a square has 4, and adding the lengths of all the sides gives the perimeter.Geometry · Kindergarten, Grade 1, Grade 2OutlierAn outlier is a data value that is far away from most of the other values in a set. In 4, 5, 6, 7, 50, the value 50 is an outlier. A common test flags any value more than 1.5 times the interquartile range below the first quartile or above the third. Outliers pull the mean strongly.Statistics · Grade 6, Grade 7, Grade 8Y-InterceptThe y-intercept is the point where a graph crosses the y-axis. Every point on the y-axis has x = 0, so you find the y-intercept by putting x = 0 into the equation. In y = mx + b, the y-intercept is b, written as the point (0, b).Algebra · Grade 8, Algebra 1HeightHeight is how tall something is: the distance from its bottom to its top, measured straight up and down. In geometry, the height of a shape is the perpendicular distance from a base to the opposite vertex or side, so it always meets the base at a right angle. Area and volume formulas use it.Measurement · Grade 2, Grade 5, Grade 6SubstituteSubstitute means to replace a variable with a number or with an equal expression. In 4x − 1, substituting 3 for x gives 4(3) − 1. You substitute to evaluate expressions, to check whether a number is a solution, and to solve systems of equations by swapping in an equal expression.Algebra · Grade 6, Grade 7, Grade 8AverageAn average is one number that stands for the typical size of the values in a data set. In everyday math, average means the mean: add all the values, then divide by how many values there are. In statistics, the median and the mode are also kinds of average.Statistics · Grade 5, Grade 6, Grade 7CorrelationCorrelation is a measure of how strongly two variables move together in a straight-line pattern. In a positive correlation both rise together; in a negative correlation one rises as the other falls. The correlation coefficient r runs from −1 to 1: values near ± 1 are strong and values near 0 are weak. Correlation does not prove causation.Statistics · Grade 8, Algebra 1, StatisticsNumberA number is an amount or value used to count, measure, order and compare. We write numbers with digits (7), words (seven) or other symbols, but the number itself is the amount: 7 dots, the word seven and the numeral 7 all show the same number. Numbers include whole numbers, fractions, decimals and negatives.Number System · Kindergarten, Grade 1, Grade 2Linear EquationA linear equation is an equation whose graph is a straight line. In one variable, it usually has a variable to the first power, like 3x + 2 = 14. In two variables, it can be written in forms like y = mx + b, where m is the slope. No variable is squared, multiplied by another variable or in a denominator.Algebra · Grade 7, Grade 8, Algebra 1OriginThe origin is the point where the x-axis and the y-axis cross on the coordinate plane. Its coordinates are (0, 0), and it is labeled O. Every ordered pair tells how far to move from the origin: (4, 3) means 4 units right, then 3 units up.Geometry · Grade 5, Grade 6, Grade 8MeanThe mean is the sum of the values divided by the number of values. It is the arithmetic average: add every value and divide by how many there are. For 3, 7, 5 and 9, the mean is 24 ÷ 4 = 6. The mean is the balance point of the data, so one outlier can pull it far.Statistics · Grade 5, Grade 6, Grade 7Mathematical ModelA mathematical model represents a real situation using numbers, equations, diagrams, or graphs, well enough to make predictions. The equation C = 15 + 9m can model the cost of a subscription after m months. Every model simplifies, and knowing what a model leaves out is as important as knowing what it includes.Problem Solving · Grade 6, Grade 7, Grade 8Slope-Intercept FormSlope-intercept form is the linear equation form y = mx + b, where m is the slope and b is the y-intercept. You can read both values directly from the equation without rearranging: in y = 2x + 5, the slope is 2 and the line crosses the y-axis at (0, 5).Algebra · Grade 8, Algebra 1Two-Way TableA two-way table shows counts for two categorical variables collected from the same group, with one variable in the rows and the other in the columns. Each inside cell is a joint frequency, and the totals in the margins are marginal frequencies. Dividing a cell by a row or column total gives relative frequencies that reveal associations.Statistics · Grade 8, Algebra 1