How to Determine the Angle Between Two Lines

When you want to know the angle between two lines, you can find the angle between their directional vectors. If you have a line l along the vector r→l = (a,b,c) and a line m along the vector r→m = (d,f,g), you can find the angle α between the two lines this way:

Formula

The Angle Between Two Lines

cos ⁡ α = r→l ⋅r→m |r→l| ⋅|r→m| ,α ∈[0°, 180°]

Note! If α > 90°, the real angle between the lines is β = 180° − α. This is because the angle between two lines always is ≤ 90°.

Example 1

You have a line l along the vector r→l = (2, 3, 4) and a line m along the vector r→m = (1,−2, 1). The angle between them is

cos ⁡ α = (2, 3, 4) ⋅(1,−2, 1) | (2, 3, 4)| ⋅|(1,−2, 1)| = 2 ⋅ 1 + 3 ⋅(−2) + 4 ⋅ 1 22 + 32 + 42 ⋅12 + (−2 ) 2 + 12 = 2 − 6 + 4 29 ⋅6 = 0, α = cos ⁡ −1 (0) = π 2 = 90°.

The lines are perpendicular!