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.

Grade 9 Math emblem with a calculator, geometric shapes, and line graph
Inside this lesson 10 sections 5 questions 7 figures

SECTION 1

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.

SECTION 2

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.

SECTION 3

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.

Scatter Plot with Line of Best FitNumber of Ads per Week (x)New Customers (y)024681012051015202530Data PointLine of Best Fitŷ = 2.5x + 1
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.

SECTION 4

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

y^=mx+bŷ = 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=Σ(xi−xˉ)(yi−yˉ)/Σ(xi−xˉ)2m = Σ(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=yˉ−m⋅xˉ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.

SECTION 5

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.

Interpreting Slope & Intercept Across Three Contexts🚗 Fuel Costŷ = 3.50x + 5x = gallons purchasedy = total cost ($)Slope:Each gallon costs $3.50 more.Intercept:$5 base charge (car wash).📱 Screen Timeŷ = −2x + 95x = hours of screen timey = test scoreSlope:Each extra hour → 2-pt drop.Intercept:95 predicted score at 0 hrs.🌱 Plant Growthŷ = 1.2x + 3x = days since plantingy = height (cm)Slope:Grows 1.2 cm per day.Intercept:3 cm height at planting.Interpretation TemplatesSLOPE:"For each additional [unit of x],the model predicts [y] will increase/decreaseby [|m|] [units of y]."Y-INTERCEPT:"When [x] is zero, the model predicts [y]will be [b] [units of y]."
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.

SECTION 6

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. 1

    Step 1 — Find the Means

    Compute 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. 2

    Step 2 — Compute the Slope Numerator

    For 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. 3

    Step 3 — Compute the Slope Denominator

    Square 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. 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. 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. 6

    Step 6 — Write the Equation & Interpret

    The 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

SECTION 7

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.

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 strengths and limitations of simple linear regression

✦

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.

SECTION 8

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.

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.

From simple linear regression to more advanced statistical modeling

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.

SECTION 9

Practice Problems

Question 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.
Show answer
The statement is not entirely correct. The slope of 4 indicates a positive association between x and y—meaning that as x increases by 1 unit, the model predicts y increases by 4 units. However, correlation does not prove causation. There could be a lurking variable (a third factor) that drives both x and y upward. To establish causation, you would need a controlled experiment, not just an observational scatter plot.

Question 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.
Show answer
(a) Substitute x = 5: ŷ = 12(5) + 30 = 60 + 30 = $90. The model predicts $90 in revenue for a 5-hour day. (b) The slope of 12 means that for each additional hour the stand is open, revenue is predicted to increase by $12. In practical terms, the stand earns roughly $12 per hour of operation.

Question 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.
Show answer
(a) m = 112 / 40 = 2.8. (b) b = ȳ − m × x̄ = 28.4 − 2.8 × 6 = 28.4 − 16.8 = 11.6. (c) The regression equation is ŷ = 2.8x + 11.6. When x = 7: ŷ = 2.8(7) + 11.6 = 19.6 + 11.6 = 31.2. The model predicts a y-value of 31.2 when x is 7. Each unit increase in x predicts a 2.8-unit increase in y, and the model's starting value when x = 0 is 11.6.

Question 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.
Show answer
(a) For each additional workout per week, the model predicts resting heart rate decreases by 3.2 bpm. A negative slope makes sense because exercise tends to improve cardiovascular fitness. (b) When x = 0 (no workouts), the model predicts a resting heart rate of 82 bpm. This is meaningful—it represents the predicted heart rate for a sedentary person, which is a reasonable value. (c) ŷ = −3.2(6) + 82 = −19.2 + 82 = 62.8 bpm. (d) No. At x = 25: ŷ = −3.2(25) + 82 = −80 + 82 = 2 bpm, which is physiologically impossible. Extrapolating far beyond the observed data range produces unreliable predictions.

Question 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?
Show answer
Student B is right to be concerned. Even though the equation itself looks reasonable, a curved pattern in the scatter plot and systematically large residuals indicate that the relationship is not truly linear. The residual plot is a critical diagnostic tool: if residuals form a U-shape or any non-random pattern, a straight line is the wrong model. Student B should consider a nonlinear model (such as a quadratic) or at minimum flag that the linear model is a poor fit. This problem highlights that checking the conditions for regression—linearity, randomness of residuals—is just as important as computing the equation. Simply having an equation does not mean it is appropriate for the data.

SUMMARY

Lesson Summary

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.