Angle Between Two Lines: Formula and Examples

#Geometry
TL;DR
The angle between two lines is found from their slopes with $\tan θ = \left|\dfrac{m_1 - m_2}{1 + m_1 m_2}\right|$, which returns the acute angle at the intersection. This article covers the slope formula, the line-equation and 3D vector forms, the parallel and perpendicular special cases, and six worked examples.
BT
Bhanzu TeamLast updated on July 27, 20269 min read

Two Roads Cross at a Junction, But at What Angle?

Every time two roads meet, a surveyor has to name the exact angle of the junction, and a single slope value on each road is enough to compute it. That is the whole problem the angle-between-two-lines formula solves: given how steeply two lines climb, find the wedge of space between them.

What Is the Angle Between Two Lines?

The angle between two lines is the measure of the inclination of one line relative to the other, taken at their point of intersection. When two lines cross, they form two pairs of angles, one acute and one obtuse, and by convention the angle between the lines means the acute angle unless a problem states otherwise.

Each straight line makes an angle of inclination with the positive x-axis, and the slope is the tangent of that inclination: $m = \tan θ_1$. If one line is inclined at $θ_1$ and the other at $θ_2$, the angle between them is simply the difference $θ_2 - θ_1$. Taking the tangent of that difference produces the working formula, which is why a couple of slope numbers tell you the whole geometry.

How Do You Find the Angle Between Two Lines?

There are three standard methods, chosen by how the lines are described. Each is the same idea in a different costume, so pick the one that matches the information you are handed.

From two slopes (2D). When you know the slopes $m_1$ and $m_2$, apply the tangent-of-the-difference identity:

$$\tan θ = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|$$

Here $m_1$ and $m_2$ are the two slopes, and the absolute value guarantees θ comes out as the acute angle. The formula is undefined when $1 + m_1 m_2 = 0$, which is exactly the perpendicular case.

From two line equations (2D). For lines $a_1 x + b_1 y + c_1 = 0$ and $a_2 x + b_2 y + c_2 = 0$, the same angle is:

$$\tan θ = \left|\frac{a_1 b_2 - a_2 b_1}{a_1 a_2 + b_1 b_2}\right|$$

This avoids solving for slope first, which is handy when a line is vertical and its slope is undefined.

From direction vectors (3D). In three dimensions two lines need not intersect, so the angle is defined through their direction vectors $\vec{a}$ and $\vec{b}$ using the dot product:

$$\cos θ = \frac{|\vec{a} \cdot \vec{b}|}{|\vec{a}|,|\vec{b}|}$$

The dot-product method also works in 2D and connects the topic to coordinate geometry as a whole. For the underlying identity, Wolfram's Line-Line Angle reference states the same result.

Where Does the Slope Formula Come From?

The derivation is one line of trigonometry. If the inclinations are $θ_1$ and $θ_2$ with $m_1 = \tan θ_1$ and $m_2 = \tan θ_2$, then the angle between the lines is $θ = θ_2 - θ_1$, and the tangent subtraction identity gives

$$\tan θ = \tan(θ_2 - θ_1) = \frac{\tan θ_2 - \tan θ_1}{1 + \tan θ_1 \tan θ_2} = \frac{m_2 - m_1}{1 + m_1 m_2}.$$

Wrapping the right side in absolute value bars selects the acute angle regardless of which line is steeper.

What Are the Conditions for Parallel and Perpendicular Lines?

Two special cases fall straight out of the slope formula, and both are worth memorising because each turns the angle question into a one-line check.

  • Parallel lines. Parallel lines share an inclination, so their slopes are equal: $m_1 = m_2$. Then $m_1 - m_2 = 0$, which forces $\tan θ = 0$ and $θ = 0°$. Equal slopes mean there is no angle between the lines.

  • Perpendicular lines. When the lines meet at a right angle the denominator vanishes: $1 + m_1 m_2 = 0$, so $m_1 m_2 = -1$. A zero denominator sends $\tan θ$ to infinity, which corresponds to $θ = 90°$.

So the slopes alone classify the pair before any full calculation: equal slopes give $0°$, a slope product of $-1$ gives $90°$, and every other case needs the tangent formula.

Examples of Angle Between Two Lines

Example 1

Find the acute angle between two lines with slopes $m_1 = 1$ and $m_2 = \tfrac{1}{2}$.

$$\tan θ = \left|\frac{1 - \tfrac{1}{2}}{1 + (1)(\tfrac{1}{2})}\right| = \left|\frac{\tfrac{1}{2}}{\tfrac{3}{2}}\right| = \frac{1}{3}$$

$$θ = \tan^{-1}!\left(\tfrac{1}{3}\right) \approx 18.43°$$

Final answer: $θ \approx 18.43°$.

Example 2 (Wrong path first)

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

Wrong attempt. A student reads the coefficients and writes $\tan θ = \dfrac{a_1 a_2 + b_1 b_2}{a_1 b_2 - a_2 b_1}$, flipping the numerator and denominator. That gives $\tan θ = \dfrac{(3)(4) + (4)(-5)}{(3)(-5) - (4)(4)} = \dfrac{-8}{-31} \approx 0.258$, so $θ \approx 14.5°$. The number looks tidy, but the formula was inverted, so the angle is wrong.

Correct. The slope form is safest here. The slopes are $m_1 = -\tfrac{3}{4}$ and $m_2 = \tfrac{4}{5}$.

$$\tan θ = \left|\frac{-\tfrac{3}{4} - \tfrac{4}{5}}{1 + \left(-\tfrac{3}{4}\right)!\left(\tfrac{4}{5}\right)}\right| = \left|\frac{-\tfrac{31}{20}}{1 - \tfrac{12}{20}}\right| = \left|\frac{-\tfrac{31}{20}}{\tfrac{8}{20}}\right| = \frac{31}{8}$$

$$θ = \tan^{-1}!\left(\tfrac{31}{8}\right) \approx 75.53°$$

Final answer: $θ \approx 75.53°$. The lines are close to perpendicular, which the wrong path had completely hidden.

Example 3

Find the acute angle between $y = 2x + 1$ and $y = -3x + 4$.

The slopes are $m_1 = 2$ and $m_2 = -3$.

$$\tan θ = \left|\frac{2 - (-3)}{1 + (2)(-3)}\right| = \left|\frac{5}{-5}\right| = 1$$

$$θ = \tan^{-1}(1) = 45°$$

Final answer: $θ = 45°$.

Example 4

Two lines have slopes $m_1 = \tfrac{2}{3}$ and $m_2 = -\tfrac{3}{2}$. Find the angle between them.

Check the product first: $m_1 m_2 = \left(\tfrac{2}{3}\right)!\left(-\tfrac{3}{2}\right) = -1$. The denominator $1 + m_1 m_2 = 0$, so $\tan θ$ is undefined.

An undefined tangent means $θ = 90°$. The lines are perpendicular, matching the slope of perpendicular lines condition.

Final answer: $θ = 90°$.

Example 5

A line passes through $(1, 2)$ and $(4, 8)$; another passes through $(0, 0)$ and $(5, 5)$. Find the acute angle between them.

First line: $m_1 = \dfrac{8 - 2}{4 - 1} = 2$.

Second line: $m_2 = \dfrac{5 - 0}{5 - 0} = 1$.

$$\tan θ = \left|\frac{2 - 1}{1 + (2)(1)}\right| = \frac{1}{3}$$

$$θ = \tan^{-1}!\left(\tfrac{1}{3}\right) \approx 18.43°$$

Final answer: $θ \approx 18.43°$.

Example 6

Find the angle between the 3D lines with direction vectors $\vec{a} = (1, 2, 2)$ and $\vec{b} = (2, 2, 1)$.

Dot product: $\vec{a} \cdot \vec{b} = (1)(2) + (2)(2) + (2)(1) = 8$.

Magnitudes: $|\vec{a}| = \sqrt{1 + 4 + 4} = 3$ and $|\vec{b}| = \sqrt{4 + 4 + 1} = 3$.

$$\cos θ = \frac{|8|}{3 \times 3} = \frac{8}{9}$$

$$θ = \cos^{-1}!\left(\tfrac{8}{9}\right) \approx 27.27°$$

Final answer: $θ \approx 27.27°$.

Why Does the Angle Between Two Lines Matter?

The formula is the quiet workhorse behind anything that measures how two directions differ. When René Descartes fused algebra with geometry, he made it possible to turn a picture of crossing lines into an equation you can compute, and the angle formula is a direct descendant of that idea; his biography at MacTutor traces the origin of coordinate methods.

Where it earns its keep:

  • Robotics and computer graphics. Collision checks and joint angles come down to the angle between direction vectors, computed with the dot-product form $\cos θ = \dfrac{|\vec{a}\cdot\vec{b}|}{|\vec{a}||\vec{b}|}$ (see the dot product reference).

  • Civil surveying. Road and rail junctions are specified by the angle at which alignments cross, read straight from their slopes.

  • Physics. Resolving forces or velocities along two lines of action starts with the angle between those lines.

The reason the acute angle is the standard answer is practical: two crossing lines make an acute and an obtuse angle that add to $180°$, and reporting the acute one removes the ambiguity.

What Are the Most Common Mistakes With the Angle Between Two Lines?

Mistake 1: Dropping the absolute value

Where it slips in: computing $\tan θ$ when the slopes have opposite signs.

Don't do this: leave $\tan θ = \dfrac{m_1 - m_2}{1 + m_1 m_2}$ as a negative number and report a negative angle.

The correct way: keep the absolute value bars. A negative tangent means you found the obtuse angle's supplement; the bars force the acute result. The first instinct is to treat the subtraction order as fixed, but the sign of the difference is exactly what the absolute value is there to absorb.

Mistake 2: Missing the perpendicular special case

Where it slips in: when $1 + m_1 m_2 = 0$.

Don't do this: push a zero denominator into a calculator and record "error" as the answer.

The correct way: recognise that $m_1 m_2 = -1$ means the lines are perpendicular, so $θ = 90°$. The rusher plugs numbers before checking the product; the pause to test $m_1 m_2$ first saves the whole problem.

Mistake 3: Confusing the acute and obtuse angle

Where it slips in: reading an obtuse angle off a diagram and assuming it is "the" angle.

Don't do this: report $104.47°$ when the convention wants the acute partner.

The correct way: if a computed angle exceeds $90°$, its supplement $180° - θ$ is the acute angle between the lines. The second-guesser often computes both and then cannot decide; the convention decides for you, take the acute one unless told otherwise.

This same acute-versus-obtuse ambiguity shows up in the real world: air-traffic controllers describing the angle at which two flight paths cross always name the smaller intersection angle, because the larger one carries no extra information and invites error. Understanding how slopes relate also underpins parallel and perpendicular lines, where the angle collapses to $0°$ or $90°$.

Conclusion

  • The angle between two lines is $\tan θ = \left|\dfrac{m_1 - m_2}{1 + m_1 m_2}\right|$, returning the acute angle at the intersection.

  • Three equivalent methods exist: slopes, line coefficients, and 3D direction vectors via the dot product.

  • Parallel lines give $θ = 0°$; perpendicular lines give $θ = 90°$ (where the denominator vanishes).

  • The most common mistake is dropping the absolute value, which flips a clean acute angle into a wrong sign.

  • The acute angle is the standard answer whenever two lines cross.

To work through more of these with a teacher, explore Bhanzu's geometry tutor or a high school math tutor, or join structured math classes online.

Practice These to Solidify Your Understanding

Work through these three, then check the slope refresher if any step feels shaky.

  1. Find the acute angle between lines with slopes $3$ and $-2$.

  2. Find the angle between $2x - y + 3 = 0$ and $x + 2y - 1 = 0$.

  3. Find the angle between the 3D lines with direction vectors $(1, 0, 1)$ and $(0, 1, 1)$.

Want a live Bhanzu trainer to walk through more angle-between-lines problems? Book a free demo class

Read More

Book a Free Demo

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

Can the angle between two lines be negative?
No. The angle between two lines is a magnitude, and the absolute value in the formula guarantees a non-negative result between $0°$ and $90°$.
What is the angle between two parallel lines?
It is $0°$. Parallel lines have equal slopes, so $m_1 - m_2 = 0$ and $\tan θ = 0$.
How do you find the angle between two lines in 3D?
Use the direction vectors and the dot product: $\cos θ = \dfrac{|\vec{a}\cdot\vec{b}|}{|\vec{a}||\vec{b}|}$. Three-dimensional lines may not intersect, so the angle is defined through direction rather than a crossing point.
Why is there an absolute value in the formula?
Because two intersecting lines form an acute and an obtuse angle. The absolute value selects the acute one, which is the conventional answer.
What if one line is vertical?
A vertical line has an undefined slope, so use the line-equation form $\tan θ = \left|\dfrac{a_1 b_2 - a_2 b_1}{a_1 a_2 + b_1 b_2}\right|$, which handles vertical lines without trouble.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →