# Angle Between Two Lines

Let two straight lines l1 and l2 be given in the xy-plane. Suppose their equations are defined in slope-intercept form:

$\ell_1:\;y = k_1x + b_1,\;\;\;\;\ell_2:\;y = k_2x + b_2,$

where k1 and k2 are the slopes of the lines, and b1 and b2 are their y-intercepts, respectively.

One of the angles φ between these lines is determined by the formula

$\tan\varphi = \frac{k_2 - k_1}{1+k_1k_2}$

The second angle is equal to π − φ.

Note that the angle between two lines is defined as the smaller angle between the two angles formed by the lines. If angle φ is acute then the angle π − φ is obtuse and vice versa.

Now let the lines be defined by equations in general form as

$\ell_1:\;a_1x + b_1y + c_1 = 0,\;\;\;\;\ell_2:\;a_2x + b_2y + c_2 = 0,$

In this case, the tangent of the angle φ between the straight lines is given by the formula

$\tan\varphi = \frac{a_2b_1 - a_1b_2}{a_1a_2 + b_1b_2}$

The examples below help in understanding the concept of the angle between two lines.

## Solved Problems

### Example 1.

Find the angle between the lines $${y = 2x - 1}$$ and $${y = \frac{1}{2}x + 1}.$$

Solution.

The given lines have the slopes $$k_1 = 2$$ and $$k_2 = \frac{1}{2}.$$ Using the formula

$\tan\varphi = \frac{k_2 - k_1}{1+k_1k_2},$

we get

$\tan\varphi = \frac{\frac{1}{2} - 2}{1+\frac{1}{2}\cdot2} = \frac{-\frac{3}{2}}{1+1} = -\frac{3}{4}.$

So one of the angles between the given lines is

$\varphi = \arctan\left({-\frac{3}{4}}\right) = -\arctan\frac{3}{4}.$

The other angle is

$\pi - \varphi = \pi - \left({-\arctan\frac{3}{4}}\right) = \pi + \arctan\frac{3}{4} = \arctan\frac{3}{4} \approx 36.9^\circ$

Hence, the angle between the lines is $$\arctan\frac{3}{4}.$$

### Example 2.

Find the angle between two lines $${5x - y + 2 = 0}$$ and $${2x - 3y + 4 = 0}.$$

Solution.

These lines are represented by equations in general form. Therefore, we use the formula

$\tan\varphi = \frac{a_2b_1 - a_1b_2}{a_1a_2 + b_1b_2}.$

Plug in the known coefficients:

$\tan\varphi = \frac{2\cdot\left(-1\right)- 5\cdot\left(-3\right)}{5\cdot2 + \left(-1\right)\cdot\left(-3\right)} = \frac{-2+15}{10+3} = \frac{\cancel{13}}{\cancel{13}} = 1.$

So the angle between these lines is

$\varphi = \arctan1 = 45^\circ.$

### Example 3.

Write equations of the lines passing through the origin and inclined at an angle of $$45^\circ$$ to the line $${y = 2x + 1}.$$

Solution.

Let the equation of the required straight line have the form $$y = kx + b.$$ Since the angle between the lines is known, we can write

$\tan\varphi = \tan 45^\circ = 1 = \frac{k - 2}{1 + 2k\cdot2} = \frac{k-2}{1+2k}.$

We obtain an equation for determining k:

$1 = \frac{k-2}{1+2k},\;\Rightarrow k - 2 = 1 + 2k, \;\Rightarrow k_1 = -3.$

So, the slope of the first line is equal to $$-3$$. Since the line passes through the origin, its y-intercept is zero, that is the equation of the line is $$y = -3x.$$

To find the equation of the second line, let's make the above expression equal to π − φ. This yields:

$\frac{k-2}{1+2k} = \tan\left({\pi-\varphi}\right) = \tan 135^\circ = -1, \;\Rightarrow k-2 = -\left({1+2k}\right),\;\Rightarrow 3k = 1, \;\Rightarrow k_2 = \frac{1}{3}.$

Hence, the equation of the second line is $$y = \frac{1}{3}x.$$

$y = -3x,\;y = \frac{1}{3}x.$

### Example 4.

Find the equation of the bisector of the acute angle between the lines $$x - 7y - 1 = 0$$ and $$x + y + 7 = 0.$$

Solution.

First we rewrite the equations of our lines in slope-intercept form and find the point of their intersection.

$\begin{cases} x - 7y - 1 = 0 \\ x + y + 7 = 0 \end{cases}, \;\Rightarrow \begin{cases} y = \frac{1}{7}x - \frac{1}{7} \\ y = -x - 7 \end{cases}.$

Equating the right-hand sides, we get

$\frac{1}{7}x - \frac{1}{7} = -x - 7, \;\Rightarrow x - 1 = -7x - 49, \;\Rightarrow 8x = -48, \;\Rightarrow x = -6.$

Hence, the $$y-$$coordinate of the intersection point is

$y = - x - 7 = -\left({-6}\right) - 7 = 6 - 7 = -1.$

We see that the lines intersect at the point $${\left({-6,-1}\right)}.$$ Their slope coefficients are, respectively, $$k_1 = \frac{1}{7}$$ and $$k_2 = -1,$$ so the straight lines look like shown in Figure $$3.$$

Let the bisector equation have the form $$y = kx + b.$$ To find the slope $$k$$ of the bisector we equate the tangents of the angles $$\varphi$$ between the second line and the bisector and between the bisector and the first line:

$\tan\varphi = \frac{k_2 - k}{1 + k_2k} = \frac{k - k_1}{1 + kk_1},\;\Rightarrow \frac{-1 - k}{1 - k} = \frac{k - \frac{1}{7}}{1 + \frac{1}{7}k},\;\Rightarrow \frac{k + 1}{k - 1} = \frac{7k - 1}{7 + k},$
$\Rightarrow \left({k+1}\right)\left({7+k}\right) = \left({7k-1}\right)\left({k-1}\right)\;\Rightarrow 7k+7+k^2+k = 7k^2-k-7k+1,\;\Rightarrow 6k^2 - 16k - 6 = 0, \;\Rightarrow 3k^2 - 8k - 3 = 0.$

This quadratic equation has the roots:

$3k^2 - 8k - 3 = 0,\;\Rightarrow D = \left({-8}\right)^2 - 4\cdot3\cdot\left({-3}\right) = 100, \;\Rightarrow k = \frac{8 \pm \sqrt{100}}{6} = 3,-\frac{1}{3}.$

We will choose the value $${-\frac{1}{3}}$$ since the bisector divides an acute angle. To find the value of $$b,$$ we plug in the coordinates of the point of intersection $${\left({-6,-1}\right)}:$$

$y = -\frac{1}{3}x + b, \;\Rightarrow -1 = -\frac{1}{3}\cdot\left({-6}\right) + b,\;\Rightarrow b = -3.$

So, the desired equation of the bisector is

$y = -\frac{1}{3}x - 3,$

or

$x + 3y + 9 = 0.$