Two points determine a line. To write its equation, find the slope from the two points, then use point-slope form with either one.
Why it works
Slope is the same between any two points on a line, so the two given points tell you the slope: $$m = \frac{y_2 - y_1}{x_2 - x_1}$$ Once you know the slope, either point works in point-slope form, because both lie on the same line. Using the other point gives an equation that looks different at first but simplifies to the same slope-intercept form. That makes a handy check.
Key idea
Slope first: $m = \frac{y_2 - y_1}{x_2 - x_1}$, with the same order on top and bottom. Then $y - y_1 = m(x - x_1)$, and check with the other point.
Worked examples
Worked example: Two points to an equation
Write the equation of the line through $(-2, 7)$ and $(4, -2)$ in slope-intercept form.
- Slope: $m = \frac{-2 - 7}{4 - (-2)} = \frac{-9}{6} = -\frac{3}{2}$.
- Point-slope with $(-2, 7)$: $y - 7 = -\frac{3}{2}(x + 2)$.
- Distribute: $y - 7 = -\frac{3}{2}x - 3$, so $y = -\frac{3}{2}x + 4$.
- Check with $(4, -2)$: $-\frac{3}{2}(4) + 4 = -6 + 4 = -2$.
Answer: $y = -\frac{3}{2}x + 4$
Worked example: From a table
A table has the rows $(1, 5)$ and $(3, 11)$. Write the linear rule.
- Slope: $\frac{11 - 5}{3 - 1} = \frac{6}{2} = 3$.
- $y - 5 = 3(x - 1)$, so $y = 3x + 2$.
Answer: $y = 3x + 2$
Two special cases: if the two points have the same $y$, the slope is $0$ and the line is horizontal, $y = b$. If they have the same $x$, the slope formula would divide by $0$; the line is vertical, $x = a$, and it has no slope-intercept form. Horizontal and vertical lines get their own lesson soon.
Common mistake
Subtracting the coordinates in different orders on top and bottom, like $\frac{-2 - 7}{-2 - 4}$, which gives $+\frac{3}{2}$ instead of $-\frac{3}{2}$. Keep one point first in both places. A quick check: if the line falls from left to right, the slope must be negative.