How to Find Where Two Lines Cross

Finds where y = a₁x + b₁ and y = a₂x + b₂ cross. Setting the two right-hand sides equal gives x, and putting that back into either line gives y. The angle between the lines is also shown.

This finds where y=a1x+b1y = a_1x + b_1 and y=a2x+b2y = a_2x + b_2 cross. At that point both lines give the same yy, so setting the right-hand sides equal gives xx.

x=b2b1a1a2x = \dfrac{b_2 - b_1}{a_1 - a_2}

a1a_1 and a2a_2 are the slopes, b1b_1 and b2b_2 the intercepts. Putting that xx back into either line gives yy. The angle between the lines is also shown.

The angle

The angle comes from tanθ=a1a21+a1a2\tan\theta = \left|\dfrac{a_1 - a_2}{1 + a_1a_2}\right|. When 1+a1a21 + a_1a_2 is 0, meaning the slopes multiply to 1-1, the lines are perpendicular and the angle is 90 degrees.

Example

For y=2x+1y = 2x + 1 and y=x+7y = -x + 7, setting 2x+1=x+72x + 1 = -x + 7 gives 3x=63x = 6, so x=2x = 2. Putting that back into y=2x+1y = 2x + 1 gives y=5y = 5. The angle follows from tanθ=3÷(1)=3\tan\theta = \left|3 \div (-1)\right| = 3, about 71.6 degrees.

Notes

Two lines with the same slope are parallel and never cross. If the intercepts match as well they are the same line, and no single crossing point exists. Neither case is calculated.

A vertical line such as x=3x = 3 cannot be written in this form, because it has no slope.