PRE-ALGEBRA • EXPRESSIONS, EQUATIONS & INEQUALITIES

Writing Linear Equations (y=mx+b) — I can write a linear equation in the form y=mx+b from a graph, table, or context.

Turn graphs, tables, and real-world situations into neat equations you can use to predict anything.

Where Did y = mx + b Come From?

People have been drawing straight lines for thousands of years. But writing a linear equation (an equation whose graph is a straight line) took centuries of math discoveries. Let's look at how we got the handy formula y = mx + b.

~300 BCE
Euclid & Geometry
The Greek mathematician Euclid studied lines and shapes, but he described them with words and drawings — not equations.
~825 CE
Al-Khwarizmi & Algebra
A Persian scholar named al-Khwarizmi wrote one of the first algebra textbooks. His work gave us the word "algebra" and showed how to solve equations with unknowns.
1637
Descartes & the Coordinate Plane
French mathematician René Descartes invented the x-y coordinate plane. Now people could plot equations as pictures — connecting algebra and geometry for the first time.
1800s
Slope-Intercept Form Becomes Standard
Mathematicians began writing y = mx + b as the go-to way to describe a line. The letters m (slope) and b (y-intercept) became standard in textbooks around the world.

Today, y = mx + b is everywhere. Scientists use it to predict weather trends. Business owners use it to forecast profits. You'll use it whenever you need to describe how two quantities are connected in a straight-line pattern. The big question this lesson answers is: How do I write that equation from a graph, a table, or a word problem?

Core Ideas You Need to Know

Before we start writing equations, let's nail down four key vocabulary words. Each one is a building block for y = mx + b.

1

Linear Equation

An equation that makes a straight line when you graph it. The variables (x and y) are only raised to the first power — no exponents like x² allowed.
2

Slope (m)

The steepness and direction of the line. It tells you how much y changes every time x increases by 1. Think of it as "rise over run."
3

Y-Intercept (b)

The point where the line crosses the y-axis. At this point, x = 0. It's your starting value before any changes happen.
4

Slope-Intercept Form

The format y = mx + b. The letter m holds the slope, and the letter b holds the y-intercept. Once you know m and b, you can write the whole equation.
KEY TAKEAWAY
Think of a linear equation like a recipe. The slope (m) is how much of an ingredient you add each time, and the y-intercept (b) is what you start with before adding anything. If you know those two things, you have the whole recipe — or in math, the whole equation!

Seeing y = mx + b on a Graph

A graph is the easiest place to spot slope and y-intercept. The diagram below shows the line y = 2x + 1. Notice how the line crosses the y-axis at 1 (that's b). Then for every 1 unit you move right, the line goes up 2 units (that's m).

The pink dot marks the y-intercept at (0, 1). The dashed yellow box shows one "rise over run" triangle: rise = 2, run = 1, so the slope is 2.

To write the equation from a graph, you only need two pieces of information. First, find where the line crosses the y-axis — that's your b. Second, pick two points on the line and count the rise and run between them — that gives you m. Plug both values into y = mx + b, and you're done!

The Math Behind the Equation

Let's break down the formula piece by piece. Once you understand what each letter means, writing the equation becomes as simple as filling in blanks.

SLOPE-INTERCEPT FORM
y = mx + b
y = the output (dependent variable) · m = slope (rise ÷ run) · x = the input (independent variable) · b = y-intercept (the value of y when x = 0)
SLOPE FORMULA
m = (y₂ − y₁) ÷ (x₂ − x₁)
Pick any two points on the line: (x₁, y₁) and (x₂, y₂). Subtract the y-values (that's the rise), then subtract the x-values (that's the run). Divide rise by run to get the slope.
💡 Positive vs. Negative Slope
If the line goes uphill from left to right, the slope is positive. If it goes downhill, the slope is negative. A flat (horizontal) line has a slope of 0.
FINDING b FROM A POINT
b = y − mx
If you already know the slope (m) and one point (x, y) on the line, plug them in to solve for b.

Writing Equations from Three Sources

You might be asked to write a linear equation from a graph, a table, or a real-world context. The steps are slightly different for each. The diagram below shows all three side by side.

All three methods lead to the same formula: y = mx + b. The difference is where you find m and b.
Quick-reference: finding m and b from different sources
SourceHow to find m (slope)How to find b (y-intercept)
GraphCount rise ÷ run between two points on the lineRead the y-value where the line crosses the y-axis
TablePick two rows: (y₂ − y₁) ÷ (x₂ − x₁)Find the y-value when x = 0, or use b = y − mx
ContextLook for "per," "each," or "every" — that's the rateLook for "starts with," "initial," or "already has"

Worked Examples

Example 1: From a Table

Data table for Example 1
xy
05
18
211
314
Write the equation in y = mx + b form
1
Step 1 — Find b (the y-intercept)Look for the row where x = 0. When x = 0, y = 5. So b = 5.
b = 5
2
Step 2 — Find m (the slope)Pick two rows. Let's use (0, 5) and (1, 8). The rise is 8 − 5 = 3. The run is 1 − 0 = 1. So m = 3 ÷ 1 = 3. You can check: every time x goes up by 1, y goes up by 3. ✓
m = 3
3
Step 3 — Write the equationPlug m = 3 and b = 5 into y = mx + b.
y = 3x + 5

Example 2: From a Word Problem

A pizza shop charges $12 for a plain pizza plus $2 for each topping. Write an equation for the total cost (y) based on the number of toppings (x).

Write the equation in y = mx + b form
1
Step 1 — Identify the starting value (b)The plain pizza costs $12. That's the cost before any toppings, so b = 12.
b = 12
2
Step 2 — Identify the rate of change (m)Each topping adds $2. The word "each" tells you this is the rate. So m = 2.
m = 2
3
Step 3 — Write the equationPlug m = 2 and b = 12 into y = mx + b.
y = 2x + 12
4
Step 4 — Check with a valueIf you order 3 toppings: y = 2(3) + 12 = 6 + 12 = 18. A pizza with 3 toppings costs $18. That makes sense!
Check: $18 ✓

Common Mistakes & How to Avoid Them

Even great math students slip up when writing linear equations. Here are the most common mistakes and how to dodge them.

Common mistakes when writing y = mx + b
MistakeWhy It HappensHow to Fix It
Swapping m and bStudents put the y-intercept where the slope should go, or vice versa.Remember: m is always multiplied by x. b stands alone.
Forgetting the negative sign on slopeA line going downhill has a negative slope, but students write it as positive.If the line goes down from left to right, the slope MUST be negative.
Flipping rise and runComputing run ÷ rise instead of rise ÷ run.Rise is the vertical (up/down) change. Run is the horizontal (left/right) change. Rise comes first.
Using the wrong point for bPicking any point on the line instead of the one where x = 0.The y-intercept is ONLY where the line crosses the y-axis (x = 0).
🧠 QUICK MEMORY TRICK
Think of m for "move" — how fast the line moves up or down. Think of b for "beginning" — where the line begins on the y-axis.

Connection to Future Math

Learning y = mx + b is your first step into a huge area of math. In later courses, you'll see more powerful versions of this idea. Here's a sneak peek.

How y = mx + b connects to future topics
What You Know NowWhat's Coming Next
y = mx + b (slope-intercept form)Standard form (Ax + By = C) and point-slope form y − y₁ = m(x − x₁)
One equation, one lineSystems of equations — two lines at once, finding where they cross
Straight lines onlyQuadratic equations (y = ax² + bx + c) make curves called parabolas
Finding slope from two pointsIn calculus, slope becomes "derivatives" — instant rates of change

The great news? Every one of those future topics builds on the same two ideas you've learned here: slope and y-intercept. Master them now, and you'll have a huge head start.

Practice Problems

PROBLEM 1CONCEPTUAL
In the equation y = mx + b, what does b represent? Where would you find it on a graph?
PROBLEM 2BASIC CALCULATION
A line passes through the points (0, −3) and (2, 1). Write the equation in y = mx + b form.
PROBLEM 3INTERMEDIATE
Use the table below to write a linear equation in y = mx + b form. x: 2, 4, 6, 8 y: 9, 15, 21, 27
PROBLEM 4APPLIED
Mia has $50 in her savings account. She adds $15 every week. Write a linear equation for the total amount of money (y) after x weeks. How much will she have after 10 weeks?
PROBLEM 5CRITICAL THINKING
Two friends are reading the same 300-page book. Alex has already read 80 pages and reads 20 pages per day. Bella has already read 30 pages and reads 30 pages per day. Write an equation for each person. On which day will they be on the same page?

Lesson Summary

A linear equation in slope-intercept form is written as y = mx + b, where m is the slope (rise over run — how steep the line is) and b is the y-intercept (where the line crosses the y-axis, or the starting value). You can find m and b from a graph by reading the y-intercept and counting rise ÷ run, from a table by calculating the change in y over the change in x, or from a real-world context by identifying the rate and starting amount.

Remember: m stands for "move" (how fast the line moves) and b stands for "beginning" (where the line begins on the y-axis). Always check your equation by plugging in a known point. Mastering y = mx + b prepares you for systems of equations, standard form, and eventually quadratic equations in Algebra and beyond.

Varsity Tutors • Pre-Algebra • Writing Linear Equations (y=mx+b)