Lines in the Plane: Equations, Distance and Angles
A line in the plane can be written as Ax + By + C = 0 (general form), y = mx + b (slope-intercept form) or r = P + t·d (parametric form); the distance from a point (x0, y0) to the line is |Ax0 + By0 + C|/√(A2 + B2). In brief: the distance from the origin to the line 3x + 4y − 10 = 0 is |−10|/5 = 2, and the angle between the lines y = x and y = 3x satisfies tan θ = |3 − 1|/(1 + 3) = 1/2, so θ ≈ 26.57°.
This guide shows how to write a line through given data, how to convert between forms, how to compute distances from points and between parallel lines, and how to find angles between lines, using normal and direction vectors.
What are the equations of a line?
A line is determined by a point P = (x0, y0) and a direction vector d = (d1, d2), or equivalently by a point and a normal vector n = (A, B) perpendicular to the line.
- Parametric: x = x0 + t d1, y = y0 + t d2.
- General: A(x − x0) + B(y − y0) = 0, that is Ax + By + C = 0, with normal (A, B).
- Slope-intercept: y = mx + b, with slope m = d2/d1 (not possible for vertical lines).
- Two points (x1, y1), (x2, y2): (y − y1)(x2 − x1) = (x − x1)(y2 − y1).
- Intercept form: x/p + y/q = 1 for a line meeting the axes at (p, 0) and (0, q).
Example 1: through two points
Through (1, 2) and (4, 8): d = (3, 6), the normal is (6, −3) or (2, −1), and the equation is 2(x − 1) − (y − 2) = 0, that is 2x − y = 0, or y = 2x.
Example 2: through a point with a given normal
Through (3, −1) with the normal (2, 5): 2(x − 3) + 5(y + 1) = 0, so 2x + 5y − 1 = 0.
Example 3: a perpendicular line
The line perpendicular to 3x − 2y + 5 = 0 through (1, 1): the direction of the new line is the normal (3, −2) of the old one, and its normal is (2, 3). So 2(x − 1) + 3(y − 1) = 0, that is 2x + 3y − 5 = 0.
How do you convert between forms?
From parametric to general, eliminate t; from general to parametric, take a point on the line and the direction (B, −A) (or (−B, A)); from general to slope-intercept, solve for y: m = −A/B.
Example 4: from general to parametric
3x + 4y − 12 = 0. A point: (4, 0). Direction: (4, −3). So x = 4 + 4t, y = −3t. Check t = 1: (8, −3): 24 − 12 − 12 = 0 ✓.
Example 5: from parametric to general
x = 2 + 3t, y = 1 − t. From the second, t = 1 − y; substituting, x = 2 + 3 − 3y, so x + 3y − 5 = 0.
How do you find the distance from a point to a line?
For the line Ax + By + C = 0 and the point P0 = (x0, y0): d = |Ax0 + By0 + C|/√(A2 + B2). It is the length of the projection of the vector from any point of the line onto the unit normal. Two parallel lines Ax + By + C1 = 0 and Ax + By + C2 = 0 are at the distance |C1 − C2|/√(A2 + B2).
Example 6: a point and a line
The distance from (2, 3) to 3x + 4y − 10 = 0: |6 + 12 − 10|/5 = 8/5 = 1.6.
Example 7: parallel lines
x + 2y − 3 = 0 and 2x + 4y + 8 = 0. Rewrite the second as x + 2y + 4 = 0. The distance is |−3 − 4|/√5 = 7/√5 ≈ 3.13.
Example 8: the height of a triangle
Triangle A(0, 0), B(6, 0), C(2, 4). The line AB is y = 0, so the height from C is 4 and the area is (1/2) · 6 · 4 = 12.
How do you find the angle between two lines?
Two lines intersect at an acute (or right) angle θ. With normals n1, n2 (or directions): cos θ = |n1 · n2|/(|n1||n2|). With slopes m1, m2: tan θ = |(m2 − m1)/(1 + m1m2)|, and the lines are perpendicular when m1m2 = −1 and parallel when m1 = m2.
Example 9: using slopes
y = x and y = 3x: tan θ = 2/4 = 1/2, θ ≈ 26.57°.
Example 10: using normals
x + y = 1 and x + 2y = 5. n1 = (1, 1), n2 = (1, 2): |n1 · n2| = 3, |n1| = √2, |n2| = √5, cos θ = 3/√10 ≈ 0.9487, θ ≈ 18.43°.
Example 11: the intersection point
x + y = 1 and x + 2y = 5: subtracting gives y = 4, so x = −3. The lines meet at (−3, 4).
Table of forms and formulas
| Item | Formula | Example |
|---|---|---|
| general form | Ax + By + C = 0 | 3x + 4y − 10 = 0 |
| slope | m = −A/B | −3/4 |
| normal, direction | (A, B), (B, −A) | (3, 4), (4, −3) |
| distance from a point | |Ax0 + By0 + C|/√(A2 + B2) | (2, 3): 8/5 |
| distance of parallels | |C1 − C2|/√(A2 + B2) | 7/√5 |
| angle | tan θ = |(m2 − m1)/(1 + m1m2)| | y = x, y = 3x: 26.57° |
Where does the analytic description of lines come from?
Describing lines by equations was introduced with coordinate geometry by René Descartes and Pierre de Fermat in the 1630s. The distance formula in normal form is associated with the work of nineteenth-century analytic geometers, such as Ludwig Otto Hesse, after whom the Hessian normal form of a line and plane is named.
Which mistakes are common?
Forgetting the absolute value
Distance is never negative. The expression Ax0 + By0 + C is signed and tells on which side of the line the point lies.
Comparing lines with different scales of C
The parallel-line formula requires the same (A, B) in both equations. Rescale first, as in Example 7.
Using slopes for vertical lines
A vertical line has no slope. Use normals or directions instead.
Reporting an obtuse angle
The angle between two lines is acute or right; if the formula without absolute value gives an obtuse angle, take its supplement.