Sub topic 5
Parallel lines have equal slopes
Prerequisites and goal
This chapter assumes you can compute the slope of a line from two points, move between slope-intercept form (y = mx + b), point-slope form, and standard form (Ax + By = C), and solve one-variable linear equations with fractions. By the end you should be able to explain why parallel lines share a slope, test two lines for parallelism, and handle the edge cases that cause most errors.
The claim
Two distinct non-vertical lines in a plane are parallel if and only if they have the same slope.
"If and only if" means the statement works in both directions:
- If the slopes are equal and the lines are distinct, the lines never meet.
- If the lines never meet (and neither is vertical), their slopes are equal.
Two vertical lines are also parallel, but they have no slope. We cover that case below.
Why equal slopes mean parallel
Take two lines in slope-intercept form:
- Line 1: y = m₁x + b₁
- Line 2: y = m₂x + b₂
A point (x, y) lies on both lines only if m₁x + b₁ = m₂x + b₂. Rearranging gives
(m₁ − m₂)x = b₂ − b₁.
Consider the two cases.
- m₁ ≠ m₂. Divide by (m₁ − m₂) to get x = (b₂ − b₁)/(m₁ − m₂). There is exactly one solution, so the lines cross at exactly one point. They are not parallel.
- m₁ = m₂. The left side becomes 0, so the equation reads 0 = b₂ − b₁.
- If b₁ ≠ b₂, this is false for every x. The lines share no point, so they are parallel.
- If b₁ = b₂, this is true for every x. The two equations describe the same line.
This one equation covers the whole result. Equal slopes with different intercepts give parallel lines, and equal slopes with equal intercepts give one line.
A geometric view: the rise and run triangle
Slope is rise over run. Pick any two points on a line, and the ratio of vertical change to horizontal change is the same. Now consider two lines with slope 2/3. Starting from any point on either line, moving 3 right and 2 up lands on that line again. Each line is a copy of the other, shifted. A shift never changes direction and never closes the gap in a way that creates a crossing, so the lines stay a constant "horizontal offset" apart. The algebra above is the precise version of this picture.
Testing two lines for parallelism
The procedure is the same for any form of equation.
- Put each equation in a form where you can read the slope.
- Compare the slopes exactly.
- If the slopes are equal, compare intercepts (or check one point) to separate "parallel" from "same line."
Worked example 1: slope-intercept form
Are y = (3/4)x − 2 and y = 0.75x + 5 parallel?
The slopes are 3/4 and 0.75, which are equal. The intercepts are −2 and 5, which differ. The lines are parallel and distinct.
Worked example 2: standard form
Are 2x + 3y = 6 and 4x + 6y = 5 parallel?
Solve each for y.
- 2x + 3y = 6 gives y = −(2/3)x + 2, so m₁ = −2/3.
- 4x + 6y = 5 gives y = −(2/3)x + 5/6, so m₂ = −2/3.
The slopes match and the intercepts (2 and 5/6) differ. The lines are parallel.
For standard form there is a shortcut. For Ax + By = C with B ≠ 0, the slope is −A/B. Two lines A₁x + B₁y = C₁ and A₂x + B₂y = C₂ have equal slopes when A₁/B₁ = A₂/B₂, which is the same as A₁B₂ = A₂B₁. This cross-multiplied form avoids division and also works when B is zero, as the next section shows.
Worked example 3: solving for an unknown
For what value of k are y = kx + 1 and 6x − 2y = 7 parallel?
Rewrite the second equation: −2y = −6x + 7, so y = 3x − 7/2. Its slope is 3. Setting k = 3 gives equal slopes. The intercepts are 1 and −7/2, which differ, so for k = 3 the lines are parallel and distinct.
Vertical lines
A vertical line has the form x = c. Its run is zero, so rise/run divides by zero and the slope is undefined. You cannot compare slopes, so use a separate rule:
- Two vertical lines x = c₁ and x = c₂ are parallel if c₁ ≠ c₂, and the same line if c₁ = c₂.
- A vertical line and a non-vertical line always intersect exactly once, so they are never parallel.
Horizontal lines (y = c) have slope 0 and follow the ordinary rule. Any two horizontal lines are parallel or identical.
In standard form, a vertical line has B = 0. The cross-multiplied test A₁B₂ = A₂B₁ then reads A₁·0 = A₂·0, which is true, so it cannot tell you the line is vertical. When using that test on lines that may be vertical, also check whether both B values are zero or both are nonzero. Checking only the product can mislead you when one line is vertical and the other is not: for x = 1 (A = 1, B = 0) and y = 1 (A = 0, B = 1), A₁B₂ = 1 and A₂B₁ = 0, so the test correctly fails here. For two vertical lines, both sides are 0 and the test passes. The case to watch is a pair where both products are 0 for a different reason, such as x = 1 and the degenerate input A = 0, B = 0, which is not a line at all.
Code: an exact parallel test
Floating-point numbers can make 0.1 + 0.2 differ from 0.3, so comparing slopes with == on floats is unreliable. Python's fractions.Fraction stores exact ratios. The function below handles vertical lines and distinguishes parallel from identical.
from fractions import Fraction
def line_from_points(p, q):
"""Return ('v', c) for x = c, or ('s', m, b) for y = m*x + b."""
(x1, y1), (x2, y2) = p, q
if (x1, y1) == (x2, y2):
raise ValueError("two distinct points are required")
if x1 == x2:
return ("v", Fraction(x1))
m = Fraction(y2 - y1, x2 - x1)
b = Fraction(y1) - m * x1
return ("s", m, b)
def relation(L1, L2):
if L1[0] == "v" and L2[0] == "v":
return "same line" if L1[1] == L2[1] else "parallel"
if L1[0] == "v" or L2[0] == "v":
return "intersect once"
_, m1, b1 = L1
_, m2, b2 = L2
if m1 != m2:
return "intersect once"
return "same line" if b1 == b2 else "parallel"
a = line_from_points((0, -2), (4, 1)) # slope 3/4
b = line_from_points((0, 5), (8, 11)) # slope 3/4
c = line_from_points((2, 0), (2, 9)) # vertical
d = line_from_points((7, 0), (7, 3)) # vertical
print(relation(a, b)) # parallel
print(relation(a, c)) # intersect once
print(relation(c, d)) # parallel
print(relation(a, a)) # same lineCommon errors
| Mistake | Why it is wrong | Fix |
|---|---|---|
| Comparing the numbers in front of x without isolating y | In 2x + 3y = 6 the slope is −2/3, not 2 | Solve for y first, or use −A/B |
| Calling lines parallel after matching slopes only | Equal slopes and equal intercepts give the same line | Compare intercepts or test one point |
| Treating a vertical line as having slope 0 | Slope 0 is horizontal; vertical slope is undefined | Use the x = c rule |
| Dropping a sign when moving terms | −2y = −6x + 7 gives y = 3x − 7/2, not y = −3x | Divide every term by the coefficient of y |
| Using rounded decimals | 0.333 does not equal 1/3 | Keep fractions or use exact arithmetic |
Why this matters next
The slope test is the tool for the next steps in this tutorial. To write a line through a given point that is parallel to a known line, you keep the slope and solve for a new intercept. The distance between two parallel lines also depends on this fact, because parallel lines have the same A and B in standard form and differ only in C.
Exercise
Line L has the equation 5x − 2y = 8. (a) Find the slope of L. (b) Write the equation of the line parallel to L that passes through (2, −3), in slope-intercept form. (c) Is the line 10x − 4y = 16 parallel to L, or the same line?
Show answer
(a) Solve for y: −2y = −5x + 8, so y = (5/2)x − 4. The slope is 5/2. (b) Use the slope 5/2 and the point (2, −3): b = y − mx = −3 − (5/2)(2) = −8. The line is y = (5/2)x − 8. (c) Divide 10x − 4y = 16 by 2 to get 5x − 2y = 8, which is exactly L. The slopes match and the intercepts match, so it is the same line, not a distinct parallel line.
Exercise
For which value of k are the lines kx + 4y = 7 and 3x + 2y = 1 parallel and distinct? Then state what happens for the other values of k.
Show answer
The slope of the first line is −k/4. The slope of the second is −3/2. Setting −k/4 = −3/2 gives k = 6. Check distinctness: with k = 6 the first line is 6x + 4y = 7, and doubling the second gives 6x + 4y = 2. The right sides 7 and 2 differ, so the lines are distinct and parallel. For every other value of k the slopes differ, so the lines intersect at exactly one point.
Exercise
Decide whether the line through (1, 2) and (1, 8) is parallel to the line through (4, 0) and (4, −5). Explain why computing slopes does not work here.
Show answer
Both lines have equal x-coordinates for their two points, so both are vertical (x = 1 and x = 4). Slope would require dividing by zero, so it is undefined and cannot be compared. Use the vertical-line rule instead: two vertical lines with different constants (1 and 4) are parallel and distinct.