Sub topic 5
Writing the Equation of a Line
Assume you know fractions, ratios, solving linear equations, and the coordinate plane. You should also be comfortable finding the slope between two points.
A straight line has a constant rate of change. The slope measures this rate:
\[ m=\frac{y2-y1}{x2-x1} \]
The equation of a line can be written in several equivalent forms. Choose the form that uses the information given in the question most directly.
The main forms
| Form | Equation | Best used when |
|---|---|---|
| Slope-intercept | \(y=mx+c\) | The slope and \(y\)-intercept are known |
| Point-slope | \(y-y_1=m(x-x_1)\) | One point and the slope are known |
| Two-point | \(y-y_1=\frac{y_2-y_1}{x_2-x_1}(x-x_1)\) | Two points are known |
| Intercept | \(\frac{x}{a}+\frac{y}{b}=1\) | The \(x\)- and \(y\)-intercepts are known |
| General | \(Ax+By+C=0\) | Comparing lines or using algebraic methods |
Here, \(c\) is the \(y\)-intercept, the point where the line crosses the \(y\)-axis.
From two points to an equation
Suppose a line passes through \(A(2,3)\) and \(B(6,11)\).
First find its slope:
\[ m=\frac{11-3}{6-2}=\frac{8}{4}=2 \]
Use point-slope form with either point:
\[ y-3=2(x-2) \]
Expanding gives:
\[ y-3=2x-4 \]
\[ y=2x-1 \]
The line therefore has slope \(2\) and \(y\)-intercept \(-1\). Substituting both original points confirms the equation.
def line_through_points(p, q):
x1, y1 = p
x2, y2 = q
if x1 == x2:
return f"x = {x1}" # vertical line
slope = (y2 - y1) / (x2 - x1)
intercept = y1 - slope * x1
return f"y = {slope}x + {intercept}"
print(line_through_points((2, 3), (6, 11)))Special and converted forms
A vertical line has an undefined slope because its \(x\)-coordinate is constant. Its equation is:
\[ x=k \]
A horizontal line has slope \(0\), so its equation is:
\[ y=k \]
To convert \(Ax+By+C=0\) into slope-intercept form, solve for \(y\):
\[ 2x+3y-6=0 \]
\[ 3y=-2x+6 \]
\[ y=-\frac23x+2 \]
Thus the slope is \(-\frac23\), and the \(y\)-intercept is \(2\).
The intercept form is useful when a line crosses the axes at \((a,0)\) and \((0,b)\). Its equation is:
\[ \frac{x}{a}+\frac{y}{b}=1 \]
For example, intercepts \(4\) and \(6\) give:
\[ \frac{x}{4}+\frac{y}{6}=1 \]
CAT strategy
If two points are given, calculate the slope first. If the options use \(Ax+By+C=0\), substitute a point into each option instead of fully rearranging every equation. Always test one known point. This catches sign and coordinate-order errors quickly.
Exercise
Find the equation of the line through \((-1,4)\) and \((3,-4)\).
Show answer
The slope is \((-4-4)/(3-(-1))=-8/4=-2\). Using \(y-4=-2(x+1)\) gives \(y=-2x+2\).