← All skill guides

Write the Equation of a Line: Step-by-Step Guide

The equation of a line tells you every point that sits on that line. Two common forms are slope-intercept form, y = mx + b, and point-slope form, y - y1 = m(x - x1). In y = mx + b, m is the slope and b is where the line crosses the y-axis. You can build the equation from a slope and one point, or from two points.

Math Racer skill guide · Algebra 1 · Grade 9

How to solve it, step by step

  1. Find the slope. If you are given two points, use m = (y2 - y1) / (x2 - x1). If the slope is already given, use it.
    \[m = \dfrac{y_2 - y_1}{x_2 - x_1}\]
  2. Write the equation in point-slope form. Put the slope and one of the points into y - y1 = m(x - x1).
    \[y - y_1 = m(x - x_1)\]
  3. Change it to slope-intercept form. Multiply out the parentheses and then get y by itself. You will get y = mx + b, where b is the y-intercept.
    \[y = mx + b\]
  4. Check with a point. Put one of the original points into your final equation. Both sides should be equal.
    \[y_1 \stackrel{?}{=} m\,x_1 + b\]

Worked example

Write the equation of the line passing through (2, 3) and (6, 11) in slope-intercept form.

Step 1: Find the slope: m = (11 - 3) / (6 - 2) = 8 / 4 = 2.

Step 2: Use point-slope form with the point (2, 3): y - 3 = 2(x - 2).

Step 3: Multiply out and add 3 to both sides: y - 3 = 2x - 4, so y = 2x - 1.

Step 4: Check with the other point, (6, 11): 2(6) - 1 = 12 - 1 = 11. It works.

The equation is y = 2x - 1. The slope is 2 and the y-intercept is -1.

Tips and common mistakes

  • Subtract in the same order on the top and bottom. Use (y2 - y1) / (x2 - x1), not (y2 - y1) / (x1 - x2).
  • If both points have the same x, the line is vertical. Its equation is x = that number, and its slope is undefined.
  • If both points have the same y, the line is horizontal. The slope is 0 and the equation is y = that number.
  • You can use either point in point-slope form. You will get the same final equation.
  • Parallel lines have the same slope. Perpendicular lines have slopes that multiply to -1.
  • Another way to find b: put the slope and one point into y = mx + b and solve for b.
  • Some problems ask for standard form, Ax + By = C. To get there, move the x term to the same side as y and clear any fractions.

Practice in Explorer · More skill guides