Sub topic 5
Writing an Equation from Two Points
Assume you can plot points, calculate slope as rise over run, use slope-intercept form, and solve equations involving fractions and negative numbers. This chapter uses those skills to build one line equation from two points.
The working method
Suppose a line passes through two points:
\[ (x1,y1) \quad \text{and} \quad (x2,y2) \]
First calculate the slope:
\[ m=\frac{y2-y1}{x2-x1} \]
Then substitute the slope and either known point into point-slope form:
\[ y-y1=m(x-x1) \]
The point-slope equation already describes the required line. You can convert it to slope-intercept or standard form if the problem asks for another form.
Worked example
Find the equation of the line through \((1,3)\) and \((4,9)\).
Step 1: Find the slope
\[ m=\frac{9-3}{4-1}=\frac{6}{3}=2 \]
Step 2: Use one point in point-slope form
Using \((1,3)\):
\[ y-3=2(x-1) \]
This is a correct equation for the line.
Step 3: Check or convert the result
Expand the right side:
\[ y-3=2x-2 \]
Add 3 to both sides:
\[ y=2x+1 \]
Check both points:
\[ 2(1)+1=3 \]
\[ 2(4)+1=9 \]
Both points satisfy the equation, so the equation is correct.
| Form | Equation for this line | What it shows directly |
|---|---|---|
| Point-slope | \(y-3=2(x-1)\) | A point and the slope |
| Slope-intercept | \(y=2x+1\) | Slope and y-intercept |
| Standard | \(2x-y=-1\) | Integer coefficients |
Choosing either known point
Either point produces an equivalent equation:
\[ y-3=2(x-1) \]
or
\[ y-9=2(x-4) \]
Expanding the second equation also gives:
\[ y=2x+1 \]
Choose the point that makes the arithmetic easier. If one point contains zero or small numbers, it may reduce mistakes.
from fractions import Fraction
def slope_through(p, q):
(x1, y1), (x2, y2) = p, q
if x1 == x2:
raise ValueError(f"vertical line: x = {x1}")
return Fraction(y2 - y1, x2 - x1)
p, q = (1, 3), (4, 9)
m = slope_through(p, q)
print(m) # 2Vertical lines and common errors
If the two points have the same x-coordinate, then \(x2-x1=0\). Division by zero is undefined, so the line has no slope. The equation is instead:
\[ x=x_1 \]
For example, the line through \((5,2)\) and \((5,8)\) is \(x=5\). It cannot be written in point-slope form because point-slope form requires a numerical slope.
Common errors include reversing only one subtraction, using \(x1-x2\) for the denominator but \(y2-y1\) for the numerator, and changing a subtraction sign inside point-slope form. Keep each point paired with its own coordinates.
Exercise
Find the equation of the line through (-2, 5) and (3, -5) in point-slope form. Then check whether (3, -5) satisfies your equation.
Show answer
The slope is m = (-5 - 5) / (3 - (-2)) = -10/5 = -2. Using (-2, 5), the equation is y - 5 = -2(x + 2). Substituting (3, -5) gives -5 - 5 = -2(3 + 2), or -10 = -10, so the point satisfies it.