A beginner-friendly introduction to linear regression: understand slope and intercept, see how lines capture relationships in data, and try simple prediction activities using real points and best-fit lines.
Watch — Can a Line Predict the Future?
Join Mia in this 1-minute-40-second cartoon, then try the activities below. Pause at Benji’s question to work out your answer before Helena explains.
The Height Predictor
Meet Mia. She’s 11 years old and growing fast.
Every year, she measures her height and writes it down:
| Age | Height (cm) |
|---|---|
| 8 | 120 |
| 9 | 125 |
| 10 | 130 |
| 11 | 135 |
She plots the points on a graph and connects them — it forms a straight line going up!
Mia looks at the pattern and says,
“If this line keeps going, I’ll be about 140 cm next year!”
She’s just made a prediction — using a line!
Lines Show Relationships
A line is more than a shape — it’s a story about how two things are connected.
In Mia’s case:
- The x-axis is her age.
- The y-axis is her height.
- As one increases, so does the other.
That’s called a positive relationship.
If one goes up while the other goes down, that’s a negative relationship (like “the more you spend, the less money you have left!” 💸).
The Rule of the Line
A line can be written as:
y = m x + b
- m is the slope — how steep the line is (how much it changes each step).
- b is the starting point (where it crosses the y-axis).
Example:
If Mia grows 5 cm each year and started at 120 cm when she was 8, her rule might be:
Height = 5 × (Age − 8) + 120
So when she’s 12:
5 × (12 − 8) + 120 = 140 cm
Math just became a time machine!
Activity 1 — Predict Your Own Future!
- Pick something that grows or changes:
- Your height
- Hours spent reading
- Points scored in a game
- Record it over time.
- Plot it on graph paper or Desmos.
- Draw a line that fits your points.
- Use it to predict the next value!
Bonus: Compare your prediction next week or month — how close were you?
Activity 2 — The Best-Fit Challenge
Give your friends these points:
| x | y |
|---|---|
| 1 | 2 |
| 2 | 5 |
| 3 | 7 |
| 4 | 10 |
| 5 | 13 |
Ask them to draw a line that goes as close to all the points as possible.
Whose line fits best?
That’s what computers do in linear regression — they find a line that makes the prediction errors as small as possible, using a chosen way to measure those errors. The line does not have to pass through every point.
A Quick Check — How Close Was Mia?
Suppose Mia measures 138 cm on her next birthday. Her line predicted 140 cm, so the prediction was 2 cm too high. The size of that miss — 2 cm — is called the absolute error.
Try it: If Mia measured 142 cm instead, how far off would the same prediction be? Would it be too high or too low?
Check your answer
The prediction would be 2 cm too low. Its absolute error is still 2 cm: we measure the size of the miss, whichever direction it goes.
Mia’s numbers make a simple teaching example. Real growth is uneven, so a straight-line pattern will not continue forever.
How This Connects to Machine Learning
In machine learning, computers use lines (and curves) to make predictions.
- A model predicting your height next year.
- A program estimating tomorrow’s temperature.
- A system guessing what video you’ll watch next.
Each one uses math like:
“If X changes, what will happen to Y?”
That’s exactly what your line did.
So, when you draw a line to predict something — congratulations, you’re doing the same kind of thinking as an AI model!
Takeaway Message
A line isn’t just a picture — it’s a way to predict the future.
Math helps you see where you’ve been and guess what comes next.
Optional Extensions
For Teachers / Parents / Older Students:
- Try graphing two variables that have a negative relationship (like time studying vs. time gaming).
- Use Google Sheets’ “trendline” feature to see real linear regression. See the section below.
- Discuss how errors happen when data doesn’t fit perfectly — just like real life!
Add “trendline” to a chart
- To add a trendlin, select a Chart, right click and select “Edit a Chart”
- At the Chart Editor, select the “Customize” tab
- Find “Series”, and click on the “trendline” checkbox
- You should see a line drawn alone the dots