Slide each line so it passes through the origin: Picture two straight lines drawn in 3D. Slide each one (without rotating it) until both pass through the origin — the angle between them doesn't change when you slide a line.
Now each line is just an arrow from the origin: its direction vector. So the angle between two lines is exactly the angle between their direction vectors d₁ and d₂ — the base points (where the lines 'start') are completely irrelevant.
Why we use the dot product: From the scalar (dot) product you already know d₁·d₂ = |d₁||d₂|cos θ. Rearranged, cos θ = (d₁·d₂)/(|d₁||d₂|).
But two lines actually make two angles that add to 180° (an acute one and an obtuse one). By convention we report the acute angle, so we wrap the dot product in absolute-value bars — that throws away any minus sign and keeps cos θ positive.
IB-style question — angle between two lines
Two lines have direction vectors d₁ = (1, −1, 2) and d₂ = (2, 1, 1).
Find the acute angle θ between the two lines, giving your answer in degrees.
Step by step
- The angle only needs the directions, so use cos θ = |d₁·d₂|/(|d₁||d₂|).
- Dot product: multiply matching components and add.
- Magnitude of each direction (square, add, root).
- Substitute. The dot product is already positive, so |3| = 3.
- Take the inverse cosine.
Final answer
θ = 60°.
The absolute value rescues a negative dot product: If d₁·d₂ comes out negative, the raw angle between the arrows is obtuse (more than 90°). The acute angle between the lines is its supplement.
The |…| in the formula handles this automatically: drop the minus sign, and cos θ stays positive, so θ comes out acute. Never report an angle bigger than 90° as 'the angle between two lines'.
IB-style question — when the dot product is negative
Find the acute angle between the lines with directions d₁ = (1, 2, 2) and d₂ = (2, −1, −2).
Give your answer to the nearest degree.
Step by step
- Dot product — notice it is negative here.
- Magnitudes.
- Take the modulus of the dot product, so the sign disappears.
- Inverse cosine.
Final answer
θ ≈ 64° (the acute angle; the |…| converted the obtuse arrow-angle to its acute supplement).
Perpendicular lines: dot product = 0: If the two lines are perpendicular, θ = 90°, and cos 90° = 0. The formula's top is then 0, so:
lines perpendicular ⟺ d₁·d₂ = 0.
This is the fast test the IB loves: to show two lines are at right angles, just show their direction vectors have a zero dot product — no need to compute any angle.
IB-style question — show two lines are perpendicular
Show that the lines with directions d₁ = (2, 1, 2) and d₂ = (1, 2, −2) are perpendicular.
Step by step
- Perpendicular means the dot product is zero — compute it.
- A zero dot product means cos θ = 0, so θ = 90°.
Final answer
d₁·d₂ = 0, so the lines are perpendicular. (No angle calculation needed.)