Academy
Formulas/maths/Straight Lines/Angle Between Two Lines

Angle Between Two Lines

Acute angle θ between two lines with slopes m₁ and m₂. The obtuse angle is π − θ.
Derivation

Let the two lines have inclinations θ1\theta_1 and θ2\theta_2, so m1=tanθ1m_1 = \tan\theta_1 and m2=tanθ2m_2 = \tan\theta_2. The angle from line 1 to line 2 is ϕ=θ2θ1\phi = \theta_2 - \theta_1. By the tangent subtraction identity:

tanϕ=tanθ2tanθ11+tanθ1tanθ2=m2m11+m1m2\tan\phi = \frac{\tan\theta_2 - \tan\theta_1}{1 + \tan\theta_1\tan\theta_2} = \frac{m_2 - m_1}{1 + m_1 m_2}

Two intersecting lines form two pairs of supplementary angles. Taking the acute angle θ\theta:

tanθ=m1m21+m1m2\boxed{\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|}

Special cases

Parallel: tanθ=0m1=m2\tan\theta = 0 \Rightarrow m_1 = m_2.

Perpendicular: tanθ1+m1m2=0m1m2=1\tan\theta \to \infty \Rightarrow 1 + m_1m_2 = 0 \Rightarrow m_1m_2 = -1.

General form version

For a1x+b1y+c1=0a_1x+b_1y+c_1=0 and a2x+b2y+c2=0a_2x+b_2y+c_2=0, substitute mi=ai/bim_i = -a_i/b_i:

tanθ=a1b2a2b1a1a2+b1b2\tan\theta = \left|\frac{a_1b_2 - a_2b_1}{a_1a_2 + b_1b_2}\right|
Key Idea
Vector form. Let $\vec{d_1}$ and $\vec{d_2}$ be direction vectors of the two lines. The angle $\theta$ between them satisfies:
> > $$ > \cos\theta = \frac{|\vec{d_1} \cdot \vec{d_2}|}{|\vec{d_1}||\vec{d_2}|} > $$ > > The absolute value gives the acute angle. With $\vec{d_1} = (1, m_1)$ and $\vec{d_2} = (1, m_2)$: > > $$ > \cos\theta = \frac{|1 + m_1 m_2|}{\sqrt{1+m_1^2}\sqrt{1+m_2^2}} > $$ > > The $\tan\theta$ formula and this $\cos\theta$ formula are equivalent — related by the identity $\tan\theta = \sin\theta/\cos\theta$ with $\sin\theta = |\vec{d_1} \times \vec{d_2}|/(|\vec{d_1}||\vec{d_2}|)$. In 3D, the dot product form generalises directly; the $\tan\theta$ slope form does not.