GRADE 9 MATH • STATISTICS & PROBABILITY

Linear Regression — I can fit a linear model (line of best fit) and interpret slope and intercept in context.

Discover how a single straight line can reveal hidden patterns and predict outcomes from real-world data.

Historical Context & Motivation

For centuries, scientists and mathematicians collected measurements—the heights of plants, the distances of stars, the temperatures of metals—and tried to spot patterns in the numbers. The challenge was always the same: real data is messy. No two measurements land perfectly on a smooth curve. So how do you draw the single best line through a cloud of points? That question drove some of history's greatest mathematical minds and eventually gave us the tool we call linear regression.

1805
Legendre Publishes "Least Squares"
French mathematician Adrien-Marie Legendre published the first clear description of the method of least squares, a technique for minimizing the total error between predicted and observed values.
1809
Gauss Refines the Method
Carl Friedrich Gauss demonstrated that least squares is the optimal fitting method when errors follow a normal distribution, giving the technique a solid theoretical foundation.
1886
Galton Coins "Regression"
Sir Francis Galton studied heights of parents and children. He noticed that very tall parents tended to have somewhat shorter children—a 'regression toward the mean.' The word regression stuck.
1900s–Today
Digital Age Expansion
With computers, linear regression became the backbone of data analysis—used in sports analytics, economics, medicine, and machine learning to fit models to millions of data points in seconds.

The core question that linear regression answers is deceptively simple: Given a set of (x, y) data points, what straight line comes closest to all of them? Understanding how to find that line—and what its slope and y-intercept actually mean in the real world—is the focus of this lesson.

Core Principles & Definitions

Before jumping into calculations, let's lock down the key vocabulary and ideas that make linear regression work. These four concepts form the foundation of everything that follows.

1

Scatter Plot

A graph that displays individual data points as dots on a coordinate plane. The independent variable (x) goes on the horizontal axis and the dependent variable (y) goes on the vertical axis.
2

Line of Best Fit

The straight line drawn through a scatter plot that best represents the overall trend of the data. Also called a regression line, it minimizes the total distance between itself and every data point.
3

Slope (m)

The slope tells you how much y changes for every one-unit increase in x. In context, it describes the rate of change of the relationship—for example, 'miles per hour' or 'dollars per item.'
4

Y-Intercept (b)

The value of y when x equals zero. In real-world problems, the intercept often represents a starting value or baseline—like a flat fee before any per-unit charge kicks in.
✦ KEY TAKEAWAY
Think of a line of best fit like a GPS route drawn through a neighborhood of scattered houses. The route doesn't pass through every single house, but it runs as close as possible to the most houses. The slope is like the steepness of the road—how sharply it climbs or drops—and the y-intercept is where the road begins when you first enter the neighborhood.

Visualizing the Line of Best Fit

The diagram below shows a scatter plot of data collected from a small business tracking how many social-media ads they ran each week (x) versus how many new customers they gained (y). Notice how the data points don't fall on a perfectly straight line, but there is a clear upward trend. The line of best fit captures that trend, and the vertical dashed lines show the residuals—the differences between each observed value and the predicted value on the line.

Each cyan dot represents one week's data. The purple regression line (ŷ = 2.5x + 1) shows the predicted number of new customers for any given number of ads. The pink dashed segments are residuals—the vertical gap between an observed point and the line.

Take a moment to trace the line from left to right. As x increases by 1 (one more ad per week), the line rises about 2.5 units on the y-axis (2.5 more customers). That rate of climb is the slope. Where the line crosses the y-axis at (0, 1), that's the y-intercept, meaning the model predicts about 1 new customer per week even with zero ads. Understanding these two numbers—slope and intercept—is the key to interpreting any linear model.

Mathematical Framework

You already know the slope-intercept form of a line from Algebra 1: y = mx + b. In statistics, we write the regression equation slightly differently to signal that our line is a prediction rather than an exact relationship.

REGRESSION EQUATION
ŷ = mx + b
ŷ (read "y-hat") = the predicted value of y for a given x. m = slope (rate of change). b = y-intercept (predicted y when x = 0).

The hat on ŷ is important: it reminds us that this is an estimate, not an exact value. Real data points will scatter above and below the line. The method used to find the best m and b is called least squares regression. It chooses the line that makes the sum of the squared residuals as small as possible.

SLOPE FORMULA
m = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)²
x̄ and ȳ are the means of x and y. Each xᵢ and yᵢ is a single data point. The numerator measures how x and y move together; the denominator measures how spread out x is.
Y-INTERCEPT FORMULA
b = ȳ − m · x̄
Once you know the slope m, plug in the means of x and y to find b. This guarantees the regression line always passes through the point (x̄, ȳ).
💡 Good News
You won't usually need to compute these formulas by hand. Your calculator or a spreadsheet can find m and b instantly. What matters most in this course is that you can interpret the slope and intercept in the context of the problem.

Interpreting Slope & Intercept in Context

Finding the equation is only half the job. The real power of linear regression comes when you explain what the numbers mean in the real world. Below is a detailed diagram showing three different contexts and how the same equation form, ŷ = mx + b, gets interpreted differently depending on the variables involved.

Three real-world equations with the same form, ŷ = mx + b, but with completely different meanings. The templates at the bottom give you a fill-in-the-blank sentence structure for writing contextual interpretations on any test or assignment.

A few important things to notice. First, slope can be negative. In the screen-time example, m = −2, which means test scores decrease as screen time increases. Second, the y-intercept doesn't always make practical sense. If x = 'years of experience' and b is negative, a negative starting salary has no real-world meaning—so you'd note that the intercept is outside the useful range of the data. Always think critically about whether an intercept value is meaningful in context.

Worked Example

A student collects data on hours studied (x) and exam scores (y) for 6 classmates. The data are: (1, 55), (2, 60), (3, 68), (4, 72), (5, 80), (6, 85). Find the equation of the line of best fit and interpret the slope and y-intercept in context.

Finding & Interpreting a Linear Regression
1
Step 1 — Find the MeansCompute the mean of x and y. x̄ = (1 + 2 + 3 + 4 + 5 + 6) / 6 = 21 / 6 = 3.5. ȳ = (55 + 60 + 68 + 72 + 80 + 85) / 6 = 420 / 6 = 70.
x̄ = 3.5, ȳ = 70
2
Step 2 — Compute the Slope NumeratorFor each point, calculate (xᵢ − x̄)(yᵢ − ȳ) and sum them. Deviations: (1−3.5)(55−70) = (−2.5)(−15) = 37.5; (2−3.5)(60−70) = (−1.5)(−10) = 15; (3−3.5)(68−70) = (−0.5)(−2) = 1; (4−3.5)(72−70) = (0.5)(2) = 1; (5−3.5)(80−70) = (1.5)(10) = 15; (6−3.5)(85−70) = (2.5)(15) = 37.5. Sum = 37.5 + 15 + 1 + 1 + 15 + 37.5 = 107.
Σ(xᵢ − x̄)(yᵢ − ȳ) = 107
3
Step 3 — Compute the Slope DenominatorSquare each x deviation and sum. (−2.5)² + (−1.5)² + (−0.5)² + (0.5)² + (1.5)² + (2.5)² = 6.25 + 2.25 + 0.25 + 0.25 + 2.25 + 6.25 = 17.5.
Σ(xᵢ − x̄)² = 17.5
4
Step 4 — Calculate Slope (m)m = 107 / 17.5 ≈ 6.11. This means that for each additional hour studied, the model predicts the exam score increases by about 6.11 points.
m ≈ 6.11
5
Step 5 — Calculate Y-Intercept (b)b = ȳ − m × x̄ = 70 − 6.11 × 3.5 = 70 − 21.39 ≈ 48.61. In context, the model predicts a score of about 48.61 for someone who studies 0 hours.
b ≈ 48.61
6
Step 6 — Write the Equation & InterpretThe regression equation is ŷ = 6.11x + 48.61. Slope interpretation: For each additional hour of studying, the model predicts the exam score will increase by about 6.11 points. Intercept interpretation: When study time is 0 hours, the model predicts a score of about 48.61. This could represent a baseline score a student earns from class participation alone.
ŷ = 6.11x + 48.61

Strengths & Limitations of Linear Regression

Linear regression is one of the most widely used statistical tools, but it isn't perfect. Understanding when it works well and when it falls short will help you use it wisely.

Key strengths and limitations of simple linear regression
FeatureStrengthsLimitations
SimplicityEasy to compute, easy to interpret. A slope and intercept tell a clear story.Assumes a straight-line relationship. If data curve, the model will be inaccurate.
PredictionGreat for interpolation—predicting y within the range of observed x-values.Extrapolation (predicting far outside the data range) can be unreliable.
OutliersWorks well when outliers are few and the data are roughly symmetric.A single extreme outlier can pull the line significantly, distorting slope and intercept.
CausationIdentifies the strength and direction of a linear association between variables.Correlation does not prove causation. A strong fit doesn't mean x causes y.
✦ KEY TAKEAWAY
Think of a linear model like a weather forecast: it's very useful and usually pretty good, but it works best for short-range predictions within conditions you've already observed. If you try to predict next year's weather based on today, you're extrapolating—and the forecast becomes much less reliable. Always check that your data actually look linear before trusting the model.

Connection to Advanced Topics

Simple linear regression—one x, one y, one line—is just the starting point. As you move into more advanced math and statistics courses, you'll encounter extensions of this same idea. The table below previews how the core concept grows.

From simple linear regression to more advanced statistical modeling
This LessonWhat Comes Next
One predictor variable (x)Multiple regression: uses two or more x-variables (e.g., hours studied AND hours slept) to predict y.
Line of best fit (straight)Nonlinear regression: fits curves (quadratic, exponential, logarithmic) when data aren't linear.
Correlation coefficient rCoefficient of determination r²: tells you the percentage of variation in y that is explained by the model.
Interpret slope in contextHypothesis testing on slope: in AP Statistics, you test whether the slope is significantly different from zero.

Even machine-learning algorithms that power recommendation engines and self-driving cars trace their roots back to the same least-squares idea you just learned. Mastering the basics of slope and intercept now gives you a strong foundation for every quantitative field you might explore in college and beyond.

Practice Problems

PROBLEM 1 — CONCEPTUAL
A scatter plot shows an upward trend from left to right. The regression equation is ŷ = 4x + 10. A classmate says, 'The slope of 4 proves that increasing x causes y to go up.' Is this statement correct? Explain your reasoning.
PROBLEM 2 — BASIC CALCULATION
A regression equation for a lemonade stand is ŷ = 12x + 30, where x is the number of hours the stand is open and y is the revenue in dollars. (a) What is the predicted revenue if the stand is open for 5 hours? (b) Interpret the slope in context.
PROBLEM 3 — INTERMEDIATE
Given the data set: (2, 14), (4, 22), (6, 28), (8, 36), (10, 42), the means are x̄ = 6 and ȳ = 28.4. The sum Σ(xᵢ − x̄)(yᵢ − ȳ) = 112 and Σ(xᵢ − x̄)² = 40. (a) Find the slope m. (b) Find the y-intercept b. (c) Write the regression equation and predict y when x = 7.
PROBLEM 4 — APPLIED
A fitness app records the number of weekly workouts (x) and resting heart rate in bpm (y) for 8 users. The regression equation is ŷ = −3.2x + 82. (a) Interpret the slope in the context of workouts and heart rate. (b) Interpret the y-intercept. Is it meaningful? (c) Predict the resting heart rate for someone who works out 6 times per week. (d) Would you trust a prediction for someone who works out 25 times per week? Explain.
PROBLEM 5 — CRITICAL THINKING
Two students each fit a regression line to the same data set. Student A gets ŷ = 5x + 20 and Student B gets ŷ = 5x + 20, but Student B notices a curved pattern in the scatter plot and a cluster of large residuals in the middle of the data. Student A claims the model is fine because the equation is the same either way. Who is right, and what should be done?

Lesson Summary

Linear regression is a method for fitting a line of best fit through a scatter plot of data. The equation takes the form ŷ = mx + b, where ŷ is the predicted y-value for a given x. The slope (m) tells you the rate of change—how much y is expected to increase or decrease for each one-unit increase in x. The y-intercept (b) gives the predicted value of y when x equals zero, often representing a starting value or baseline.

The least squares method finds the specific line that minimizes the sum of squared residuals (the vertical distances from points to the line). Always interpret slope and intercept in the context of the problem, and remember that a strong linear association does not prove causation. Before trusting a linear model, verify that the scatter plot actually shows a linear pattern and that residuals appear random. With these skills, you can extract meaningful stories from real-world data.

Varsity Tutors • Grade 9 Math • Linear Regression — I can fit a linear model (line of best fit) and interpret slope and intercept in context.