Backpack

Math

Slope and the equation of a line

4 min read · Updated October 21, 2026

Slope tells you how steep a line is and which way it goes. With the slope and one point, you can write the equation of any line. This guide covers finding slope, the two main forms of a line, and the special cases that show up on almost every test.

What slope means

Slope is how much y changes for each step you take to the right in x. People often say it as “rise over run”: how far the line goes up or down, divided by how far it goes across. The letter for slope is m.

A slope of 2 means the line goes up 2 for every 1 step right. A slope of −1/3 means it goes down 1 for every 3 steps right.

SlopeWhat the line doesExample
PositiveGoes up from left to righty = 2x + 1
NegativeGoes down from left to righty = −x + 4
ZeroFlat, horizontaly = 3
UndefinedStraight up and down, verticalx = −2

Slope from two points

Given two points (x₁, y₁) and (x₂, y₂), the slope is the change in y divided by the change in x: m = (y₂ − y₁)/(x₂ − x₁). It does not matter which point you call first, as long as you use the same order on the top and the bottom.

  • Subtracting a negative is adding: 4 − (−2) = 6. This is the most common slip.
  • Keep the y values on top. Run over rise gives the wrong answer.

Slope through (−2, 5) and (4, −1)

m = (y₂ − y₁)/(x₂ − x₁)

m = (−1 − 5) ÷ (4 − (−2))

m = −6 ÷ 6

m = −1

Slope-intercept form

The most common way to write a line is y = mx + b. Here m is the slope and b is the y-intercept, the y value where the line crosses the y axis. This form is handy because you can read both numbers straight off the equation and graph the line right away.

If a line comes in another form, like 2x + 3y = 6, solve for y to get it into slope-intercept form: 3y = −2x + 6, so y = −(2/3)x + 2. The slope is −2/3 and the line crosses the y axis at 2.

Writing the equation through two points

Find the slope first, then use one point to find b. Put the point’s x and y into y = mx + b and solve for b.

The line through (2, 3) and (6, 11)

m = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2

Use (2, 3) in y = mx + b: 3 = 2 × 2 + b

3 = 4 + b, so b = −1

y = 2x − 1

Check with (6, 11): 2 × 6 − 1 = 11

Point-slope form

Point-slope form is y − y₁ = m(x − x₁), where (x₁, y₁) is any point on the line. It is the fastest form to write when you know a point and the slope, because you just fill in the numbers. You can then simplify it into y = mx + b if your teacher wants that form.

Slope 2 through (2, 3) in point-slope form

y − 3 = 2(x − 2)

y − 3 = 2x − 4

y = 2x − 1

Reading a line from its graph

  1. Find where the line crosses the y axis. That y value is b.
  2. From that point, find another point where the line crosses the grid exactly at a corner.
  3. Count the rise, up is positive and down is negative, and the run to the right.
  4. Slope = rise ÷ run.
  5. Write y = mx + b and check that another grid point fits.

A line through (0, −3) and (2, 1)

It crosses the y axis at (0, −3), so b = −3

From (0, −3), go right 2 and up 4 to reach (2, 1)

Slope = 4 ÷ 2 = 2

y = 2x − 3

Horizontal and vertical lines

A horizontal line has the same y value everywhere, so its slope is 0 and its equation is just y = a number, like y = 3. A vertical line has the same x value everywhere. Its run is always 0, and you cannot divide by 0, so its slope is undefined. Its equation is x = a number, like x = −4.

An easy way to keep them apart: y = 3 is the set of all points whose y is 3, which lie in a flat row. x = −4 is all points whose x is −4, which lie in a standing column.

Parallel and perpendicular lines

Parallel lines never meet, so they have the same slope. Perpendicular lines cross at a right angle, and their slopes are negative reciprocals: flip the fraction and change the sign. Two perpendicular slopes always multiply to −1, unless one line is horizontal and the other vertical.

Perpendicular to y = (2/3)x + 1, through (4, −1)

Perpendicular slope: flip 2/3 to 3/2 and change the sign, m = −3/2

Point-slope: y − (−1) = −(3/2)(x − 4)

y + 1 = −(3/2)x + 6

y = −(3/2)x + 5

Check with (4, −1): −(3/2) × 4 + 5 = −6 + 5 = −1

Slope of the lineParallel slopePerpendicular slope
22−1/2
−3/4−3/44/3
11−1
0 (horizontal)0undefined (vertical)
Practice slope and linesEndless problems, checked on the spot, free and no account needed.

Related guides

Do this in Backpack

Make a free account and your math score and streak follow you to any device, with practice from a photo of your worksheet.

  • Read-only with Canvas
  • Free to start
  • Never does your work
  • Made by a student

The Backpack iPhone app is coming soon to the App Store

Slope and the equation of a line · Backpack