Two roads cross on a map. At what angle do they meet? How far is a village from a straight highway? Coordinate geometry answers both with short formulas. In this lesson you will find the angle between two lines from their slopes, and the perpendicular distance from a point to a line, which is the shortest distance between them.
In this lesson you will learn
- How the slope of a line links to the angle it makes with the x-axis
- The formula for the angle between two lines
- The tests for parallel and perpendicular lines
- The formula for the distance from a point to a line
- How to find the distance between two parallel lines
You should know the equation of a straight line, the distance formula and compound angles.
Slope and Angle
A line that makes an angle α with the positive x-axis has slope m = tan α. The line y = 2x + 1 has slope 2, so tan α = 2 and α ≈ 63.43°. The line y = −x + 4 has slope −1, so α = 135°.
The Angle Between Two Lines
If two lines have slopes m₁ and m₂, the angle θ between them is the difference of their angles with the x-axis. The tan(A − B) formula then gives:
tan θ = | (m₁ − m₂) / (1 + m₁m₂) |
The modulus sign gives the acute angle. Two lines that cross make two angles, θ and 180° − θ, and we usually want the acute one.
Lines y = 2x + 1 and y = −x + 4, so m₁ = 2 and m₂ = −1
tan θ = | (2 − (−1)) / (1 + 2 × (−1)) | = | 3 / (−1) | = 3
θ = tan⁻¹ 3 ≈ 71.57°
Check: the lines make angles of 63.43° and 135° with the x-axis, and 135° − 63.43° = 71.57°.
Parallel and Perpendicular Lines
| Lines are | Condition | Why |
|---|---|---|
| Parallel | m₁ = m₂ | The top of the formula is 0, so θ = 0° |
| Perpendicular | m₁m₂ = −1 | The bottom is 0, so tan θ is undefined and θ = 90° |
For example, y = 3x − 2 and y = −x/3 + 5 are perpendicular, because 3 × (−1/3) = −1.
Distance From a Point to a Line
The distance from a point to a line always means the shortest distance, which is along the perpendicular. For the point (x₁, y₁) and the line ax + by + c = 0:
d = | ax₁ + by₁ + c | / √(a² + b²)
Put the line in the form ax + by + c = 0 first. Then substitute the point into the left side, take the size, and divide by √(a² + b²).
Point (3, 4), line 3x + 4y − 5 = 0
d = | 3×3 + 4×4 − 5 | / √(3² + 4²)
= | 9 + 16 − 5 | / 5
= 20 / 5 = 4 units
The perpendicular meets the line at (0.6, 0.8), called the foot of the perpendicular. The distance from (3, 4) to (0.6, 0.8) is √(2.4² + 3.2²) = √16 = 4, which agrees.
Distance Between Two Parallel Lines
Parallel lines can be written with the same a and b. Then the gap between them is:
d = | c₁ − c₂ | / √(a² + b²)
3x + 4y − 5 = 0 and 3x + 4y + 10 = 0
d = | −5 − 10 | / 5 = 15 / 5 = 3 units
Common Mistakes
- Using y = mx + c in the distance formula. Rearrange to ax + by + c = 0 first. For y = 2x + 1, use 2x − y + 1 = 0.
- Forgetting the modulus. A distance can never be negative.
- Mismatched parallel lines. Scale the equations so a and b are the same before using |c₁ − c₂|.
- Giving the obtuse angle. The modulus in the angle formula gives the acute angle; subtract from 180° only if the obtuse one is asked for.
Practice Exercises
Exercise 1. Find the distance from the origin to the line x + y − 2 = 0.
Show answer
d = |0 + 0 − 2| / √(1 + 1) = 2/√2 = √2 ≈ 1.414 units.
Exercise 2. Find the acute angle between y = x and y = √3 x.
Show answer
m₁ = √3, m₂ = 1. tan θ = (√3 − 1)/(1 + √3) = tan(60° − 45°) = tan 15°. So θ = 15°, which matches 60° − 45°.
Exercise 3. For what value of k are 2x + ky = 5 and 3x − 6y = 1 perpendicular?
Show answer
The slopes are −2/k and 3/6 = 1/2. Perpendicular means (−2/k)(1/2) = −1, so −1/k = −1 and k = 1.
Frequently Asked Questions
Why is the perpendicular distance the shortest?
Any other path from the point to the line is the hypotenuse of a right triangle whose other side is the perpendicular. A hypotenuse is always longer than either other side.
What if one of the lines is vertical?
A vertical line has no slope, so the angle formula cannot be used directly. Find the angle the other line makes with the x-axis. The angle between the lines is the difference between that angle and 90 degrees.
Summary
- The acute angle between two lines satisfies tan θ = |(m₁ − m₂)/(1 + m₁m₂)|.
- Parallel lines have m₁ = m₂; perpendicular lines have m₁m₂ = −1.
- Distance from (x₁, y₁) to ax + by + c = 0 is |ax₁ + by₁ + c| / √(a² + b²).
- Parallel lines ax + by + c₁ = 0 and ax + by + c₂ = 0 are |c₁ − c₂| / √(a² + b²) apart.
Next: Locus in Coordinate Geometry.
