Slope-Intercept Form (y = mx + b)

The most common way to write the equation of a straight line is slope-intercept form:

y = mx + b

  • m is the slope.
  • b is the y-intercept: the y value where the line crosses the y-axis. The line passes through the point (0, b).

Reading m and b from an equation

  • y = 2x − 3: slope m = 2, y-intercept b = −3.
  • y = −½x + 4: slope m = −1/2, y-intercept b = 4.
  • y = x: slope m = 1, y-intercept b = 0. The line passes through the origin.
  • y = 5: slope m = 0, y-intercept b = 5. This is a horizontal line.

The equation must start with y on its own. If it doesn’t, rearrange it first. For example, 2x + 3y = 6 becomes 3y = −2x + 6, and then y = −⅔x + 2, so m = −2/3 and b = 2.

Graphing a line from y = mx + b

  1. Plot the y-intercept (0, b).
  2. Use the slope as rise over run to find a second point. For m = 2/3, go up 2 and right 3.
  3. Draw a straight line through the two points.
−4−224−4−224run = 3rise = 2(0, 1)(3, 3)
y = ⅔x + 1: start at (0, 1), go up 2 and right 3 to reach (3, 3).

Writing the equation from the slope and one point

Example

A line has slope 3 and passes through (2, 5). Find its equation.

Put m = 3, x = 2 and y = 5 into y = mx + b: 5 = 3 × 2 + b, so 5 = 6 + b, and b = −1.

The equation is y = 3x − 1.

Writing the equation from two points

Example

Find the equation of the line through (−2, −1) and (2, 2).

Slope: m = (2 − (−1)) ÷ (2 − (−2)) = 3/4.

Intercept: −1 = ¾ × (−2) + b, so −1 = −3/2 + b, and b = 1/2.

The equation is y = ¾x + ½. Check with the other point: ¾ × 2 + ½ = 3/2 + 1/2 = 2. ✓

Check this example in Slope Finder →

Why this form is useful

Slope-intercept form shows the two most useful facts about a line at a glance. It also makes predictions easy: to find y for any x, just substitute. Lines with the same m are parallel, which you can spot straight away in this form.

The one line you can’t write this way is a vertical line, because its slope is undefined. Its equation is x = a number instead.