8TH GRADE MATHEMATICS • FUNCTIONS

Understanding y = mx + b: The Equation Behind Every Straight Line

Discover how one simple equation can describe any straight line on a graph — and why that matters.

Where Did Straight-Line Equations Come From?

People have been drawing straight lines for thousands of years — think of a ruler on a piece of papyrus. But writing an equation that describes a line? That took some brilliant thinking over many centuries. Let's look at how this idea developed.

~300 BC
Euclid
Euclid, a Greek mathematician, wrote Elements — one of the most famous math books ever. He described lines using geometry (shapes and angles) but never used equations with x and y. Lines were drawn, not calculated.
~800 AD
Al-Khwarizmi
Al-Khwarizmi, a scholar in Baghdad, helped invent algebra. He showed how to solve equations with unknown values. His work gave us the word "algebra" itself (from the Arabic al-jabr).
1637
René Descartes
René Descartes, a French mathematician, combined algebra and geometry for the first time. He invented the coordinate plane (the x-y grid you use in class). This let people describe geometric shapes — including lines — with equations.
1700s–1800s
Standard Form Emerges
Mathematicians began writing the equation of a line in a clean, standard form: y = mx + b. The letters m for slope and b for the y-intercept became common in textbooks across Europe and America.

So here's the big question this lesson answers: How can one short equation — y = mx + b — perfectly describe every straight line on a graph? And what makes this equation a function?

Core Ideas You Need to Know

Before we dive into graphing, let's lock down four key ideas. Each one is a building block for understanding y = mx + b.

1

What Is a Function?

A function is a rule that takes an input and gives you exactly one output. If you put in an x-value, you get back one and only one y-value. No surprises, no double answers.
2

What Makes It "Linear"?

The word linear comes from "line." A linear function is a function whose graph is a perfectly straight line. It grows (or shrinks) at a constant, steady rate.
3

Slope (m)

Slope tells you how steep the line is and which direction it goes. It's the rate of change — how much y changes each time x increases by 1. A positive slope goes uphill; a negative slope goes downhill.
4

Y-Intercept (b)

The y-intercept is the point where the line crosses the y-axis (the vertical axis). It's the value of y when x equals 0. Think of it as the "starting point" of the line.
KEY TAKEAWAY
Think of y = mx + b like a recipe for a straight line. The slope (m) is like the speed of a car — it tells you how fast y changes. The y-intercept (b) is like your starting location. Put them together, and you know exactly where the line begins and where it goes. For every x you plug in, you get exactly one y out — that's what makes it a function.

Seeing y = mx + b on a Graph

The best way to understand a linear equation is to see it. Below is a graph of the equation y = 2x + 1. Notice how the line is perfectly straight, crosses the y-axis at the point (0, 1), and climbs upward at a steady rate.

Graph of y = 2x + 1 showing slope triangle and y-intercept

Look at the graph carefully. The gold dot at (0, 1) is the y-intercept — that's where the line meets the y-axis. The dashed triangle between (0, 1) and (1, 3) shows the slope: for every 1 step to the right, the line goes 2 steps up. That's a slope of 2. Every point on this line follows the rule y = 2x + 1.

This graph is also proof that the equation is a function. You can check this with the vertical line test: if you draw any vertical line anywhere on the graph, it will cross the line at most once. That means each x-value has only one y-value. One input → one output. That's a function!

Breaking Down the Equation

Let's take the equation apart piece by piece. Once you understand what each letter means, you'll be able to read any linear equation like a story.

SLOPE-INTERCEPT FORM
y = mx + b
y = output | m = slope | x = input | b = y-intercept

Here's what each part does:

y is the output — the answer you get after plugging in a value for x. On a graph, y tells you how high or low the point sits.

m is the slope. It's a number that tells you the line's steepness. Slope is calculated as "rise over run" — how much y changes divided by how much x changes.

SLOPE FORMULA
m = (y₂ − y₁) / (x₂ − x₁)
Pick any two points on the line and subtract their coordinates.

x is the input — the value you choose. You get to pick any x-value you want, and the equation will give you the matching y.

b is the y-intercept. It's the value of y when x = 0. On the graph, it's where the line crosses the vertical axis. Notice that if you substitute x = 0 into y = mx + b, you get y = m(0) + b = b. That's why b is the y-intercept!

KEY TAKEAWAY
Think of m and b as the two knobs on a remote control for your line. Turn the m knob and the line tilts — steeper or flatter, uphill or downhill. Turn the b knob and the whole line slides up or down. Together, these two numbers define exactly one unique straight line.

How Slope and Intercept Change the Line

Different values of m and b create different lines. The diagram below shows three lines on the same graph so you can compare them side by side.

Comparison of three linear functions with different slopes and y-intercepts

Let's compare these three lines using a table:

EQUATIONSLOPE (m)Y-INTERCEPT (b)WHAT THE LINE DOES
y = 2x + 12 (positive, steep)1Goes up steeply from left to right; crosses y-axis at 1
y = −x + 3−1 (negative)3Goes downhill from left to right; crosses y-axis at 3
y = 0.5x − 20.5 (positive, gentle)−2Goes up gently; crosses y-axis below the origin at −2

Notice the patterns. When the slope is positive, the line goes upward as you move right. When the slope is negative, the line goes downward. A bigger absolute value of slope means a steeper line. And the y-intercept simply shifts the line up or down.

What about a slope of 0? If m = 0, the equation becomes y = b — a perfectly horizontal line! The y-value never changes no matter what x is. That's still a function (each x gives one y), and it's still linear (a horizontal line is straight).

Worked Example: From Table to Equation to Graph

Let's walk through a full problem together. Suppose you earn $8 per hour at a part-time job, plus a $15 bonus for showing up on time. Write and graph a linear equation for your total pay.

From Table to Equation to Graph
1
Step 1 — Identify the VariablesLet x = the number of hours you work. Let y = your total pay in dollars.
2
Step 2 — Find the Slope (m)You earn $8 for each hour. That means for every 1-unit increase in x, y goes up by 8. The rate of change is constant.
m = 8
3
Step 3 — Find the Y-Intercept (b)When x = 0 (you haven't worked any hours yet), you still get the $15 bonus. So your starting pay is $15.
b = 15
4
Step 4 — Write the EquationPlug m and b into y = mx + b:
y = 8x + 15
5
Step 5 — Build a Table of ValuesPick a few x-values, plug them in, and calculate y: When x = 0, y = 8(0) + 15 = $15. When x = 1, y = 8(1) + 15 = $23. When x = 2, y = 8(2) + 15 = $31. When x = 3, y = 8(3) + 15 = $39. When x = 5, y = 8(5) + 15 = $55.
6
Step 6 — Graph and InterpretPlot these points on a coordinate plane and connect them. You'll get a straight line that starts at (0, 15) and rises steadily. Every point on this line represents a possible hours-pay combination. The line is straight because the pay rate ($8/hour) never changes — and that's exactly what makes it linear.
The equation y = 8x + 15 defines a linear function. Its graph is a straight line with a slope of 8 and a y-intercept of 15.

Linear vs. Non-Linear: How to Tell the Difference

Not every equation is linear. It's important to recognize what makes y = mx + b special — and what kinds of equations do not produce straight lines.

FEATURELINEAR FUNCTIONNON-LINEAR FUNCTION
Equation formy = mx + b (x has exponent of 1)y = x², y = 2ˣ, y = √x, etc.
Graph shapePerfectly straight lineCurved (parabola, exponential curve, etc.)
Rate of changeConstant — same slope everywhereChanges — steeper in some places, flatter in others
Table patterny values increase/decrease by the same amounty values change by different amounts
Exampley = 3x − 4y = x² + 1

Here's a quick test: look at the equation. If x is raised to a power other than 1 (like x² or x³), or if x is in the denominator (like 1/x), or if x is an exponent (like 2ˣ), it's not linear. A linear function keeps x simple — just x times some number, plus another number.

Also remember: y = mx + b always defines a function. For every input x, you get exactly one output y. But not every function is linear. The equation y = x² is a function too, but its graph is a U-shaped curve called a parabola — not a straight line.

KEY TAKEAWAY
Think of a linear function like walking on a perfectly flat ramp — the steepness never changes. A non-linear function is like walking on a hilly path where the steepness keeps shifting. If the rate of change is constant and the graph is a straight line, you're looking at a linear function. The equation y = mx + b is the simplest way to describe one.

Where Does This Lead Next?

Understanding y = mx + b is one of the most important foundations in all of mathematics. Once you master it, you'll be ready for bigger ideas. Here's a sneak peek at where this goes.

WHAT YOU KNOW NOWWHAT COMES NEXT
Graphing one lineSystems of equations — graphing two lines and finding where they cross
Slope as rate of changeCalculus — finding the rate of change for curved lines (derivatives)
Linear functions (y = mx + b)Quadratic functions (y = ax² + bx + c) — curves instead of lines
One input, one outputFunction notation — writing f(x) = mx + b and evaluating f(3), f(−2), etc.
Reading slope from an equationLinear modeling — using real-world data to find the best-fit line

In high school, you'll study function notation, where y = 2x + 1 gets written as f(x) = 2x + 1. The idea is the same, but the notation lets you talk about different functions more easily. You'll also explore what happens when you combine, shift, or stretch linear functions — and then move on to functions that aren't straight lines at all. Every one of those future topics builds on what you're learning right now.

Practice Problems

Try these five problems to test your understanding. Start with the easier ones and work your way up. Click "Show Answer" when you're ready to check your work.

PROBLEM 1CONCEPTUAL
In the equation y = mx + b, what does the letter m represent, and what does it tell you about the graph of the line?
PROBLEM 2BASIC
For the equation y = −3x + 7, identify the slope and the y-intercept. Then find the value of y when x = 2.
PROBLEM 3INTERMEDIATE
A line passes through the points (1, 5) and (3, 11). Find the slope of the line. Then write the equation in y = mx + b form.
PROBLEM 4APPLIED / MULTI-STEP
A swimming pool is being filled with water. After 2 hours, the pool has 500 gallons. After 5 hours, it has 1,100 gallons. The water flows at a constant rate. (a) Write a linear equation in y = mx + b form where x = hours and y = gallons of water. (b) How many gallons were in the pool before filling started? (c) How many gallons will be in the pool after 8 hours?
PROBLEM 5CHALLENGE / CRITICAL THINKING
Maria says that the equation y = 4x² + 1 is a linear function because "it has a number times x, plus another number." Is she correct? Explain why or why not. Then give an example of a similar-looking equation that is linear.

Putting It All Together

The equation y = mx + b is called slope-intercept form, and it defines a linear function — a rule that takes any input x and produces exactly one output y. The letter m represents the slope, which tells you the rate of change — how much y increases or decreases for each 1-unit increase in x. The letter b represents the y-intercept, the point where the line crosses the y-axis (where x = 0). Together, m and b completely determine the line's position and direction.

The graph of any equation in the form y = mx + b is always a straight line. A positive slope means the line rises from left to right; a negative slope means it falls. A larger absolute value of slope means a steeper line. Because every x-value produces exactly one y-value, the equation passes the vertical line test and qualifies as a function. This single, powerful equation connects algebra and geometry, letting you describe, predict, and analyze straight-line relationships in math and the real world.

Varsity Tutors • 8th Grade Mathematics (Common Core) • Functions — Understanding y = mx + b