Angle Between Two Lines: Formula Derivation and Examples

#Angle Between Two Lines
TL;DR
The angle between two lines with slopes m1m_1 and m2m_2 is the acute angle given by tan⁡θ=∣m1−m21+m1m2∣\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|. Derivation, special cases and examples follow.
Vaishali Tomar·reviewed byShikha SharmaLast updated on December 2, 202613 min read

Key Points

  • A line's slope is the tangent of its angle of inclination: m=tan⁡αm = \tan\alpha.
  • The angle between two lines is the difference of their inclinations, which gives tan⁡θ=∣m1−m21+m1m2∣\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|.
  • The absolute value picks the acute angle of the two at a crossing, θ\theta and 180°−θ180° - \theta.
  • Equal slopes give 0°0°; m1m2=−1m_1 m_2 = -1 gives 90°90°.
  • A vertical line has no slope, so use 90°90° minus the other line's inclination.

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

Two slope numbers are enough to find the exact angle between two roads at a junction.

  • A main road runs with slope 0.250.25, and a side road joins it with slope −2-2.
  • You could draw both and use a protractor, or use the slopes: the angle between two lines here is 77.47°77.47°.
  • This is a big idea from coordinate geometry: a slope carries an angle inside it.
  • The crossing point is not needed, because sliding a line sideways keeps its slope.

What Is the Angle Between Two Lines?

Two crossing lines make two equal acute angles and two equal obtuse angles that add to 180°180°.

  • By convention, the angle between two lines is the acute one, θ\theta.
  • Perpendicular lines give 90°90°; parallel lines give 0°0°.
  • Each line has an angle of inclination α\alpha, measured anticlockwise from the positive x-axis, from 0°0° up to 180°180°.
  • The slope is its tangent: m=tan⁡αm = \tan\alpha. Slope 1 means 45°45°; slope 3 means about 71.57°71.57°.
  • A negative slope means α\alpha is between 90°90° and 180°180°.

Why the Formula Works: Inclinations and the Tan Subtraction Formula

Since each slope is the tangent of an inclination, the angle between the lines is the difference of their inclinations.

  1. Take y=3x−1y = 3x - 1 and y=0.5x+1.5y = 0.5x + 1.5, crossing at (1,2)(1, 2), with inclinations α1≈71.57°\alpha_1 \approx 71.57° and α2≈26.57°\alpha_2 \approx 26.57°.
  2. In the triangle with the x-axis, α1\alpha_1 is an outside angle, so it equals the two far interior angles, α2+θ\alpha_2 + \theta.
  3. So θ=α1−α2≈45°\theta = \alpha_1 - \alpha_2 \approx 45°.
the angle between two lines is the difference of their angles of inclination
The lines y = 3x − 1 (blue) and y = 0.5x + 1.5 (green) on a grid, crossing at (1, 2). The blue line's inclination of 71.57 degrees and the green line's 26.57 degrees are marked at the x-axis, and the orange angle θ at the crossing is 71.57° − 26.57° = 45°.

The tangent subtraction formula, with tan⁡α1=m1\tan\alpha_1 = m_1 and tan⁡α2=m2\tan\alpha_2 = m_2, gives

tan⁡(α1−α2)=m1−m21+m1m2\tan(\alpha_1 - \alpha_2) = \frac{m_1 - m_2}{1 + m_1 m_2}
  • Here 3−0.51+1.5=1\frac{3 - 0.5}{1 + 1.5} = 1, and tan⁡−11=45°\tan^{-1} 1 = 45°: the picture and the formula agree.

Why the absolute value?

  • The working formula wraps that fraction in bars: tan⁡θ=∣m1−m21+m1m2∣\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|.
  • For y=2x+1y = 2x + 1 and y=−3x+4y = -3x + 4 the fraction is 5−5=−1\frac{5}{-5} = -1, the tangent of the obtuse 135°135°.
  • Since tan⁡(180°−θ)=−tan⁡θ\tan(180° - \theta) = -\tan\theta, the bars keep the acute 45°45°.
two crossing lines make an acute angle and an obtuse angle that add to 180 degrees
The lines y = 2x + 1 and y = −3x + 4 crossing at (0.6, 2.2), with the acute angle θ = 45° in orange and the obtuse angle 180° − θ = 135° in purple. The raw fraction (m₁ − m₂)/(1 + m₁m₂) is −1.

How Do You Find the Angle Between Two Lines?

With the formula explained, pick the method that matches what you are given.

From two slopes:

tan⁡θ=∣m1−m21+m1m2∣\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|

From two equations a1x+b1y+c1=0a_1 x + b_1 y + c_1 = 0 and a2x+b2y+c2=0a_2 x + b_2 y + c_2 = 0:

tan⁡θ=∣a1b2−a2b1a1a2+b1b2∣\tan\theta = \left|\frac{a_1 b_2 - a_2 b_1}{a_1 a_2 + b_1 b_2}\right|

From direction vectors, in 3D, where lines need not meet:

cos⁡θ=∣a⃗⋅b⃗∣∣a⃗∣ ∣b⃗∣\cos\theta = \frac{|\vec{a} \cdot \vec{b}|}{|\vec{a}|\,|\vec{b}|}
  1. Get both slopes: from y=mx+cy = mx + c, from two points, or −ab-\frac{a}{b} from ax+by+c=0ax + by + c = 0.
  2. Check the special cases: equal slopes give 0°0°, product −1-1 gives 90°90°, a vertical line needs 90°−α90° - \alpha.
  3. Substitute and take the inverse tangent. For the obtuse angle, subtract from 180°180°.

What Are the Conditions for Parallel and Perpendicular Lines?

Two special cases fall straight out of the formula.

  • Parallel lines share an inclination, so m1=m2m_1 = m_2, tan⁡θ=0\tan\theta = 0 and θ=0°\theta = 0°.
  • Perpendicular lines have m1m2=−1m_1 m_2 = -1, so the bottom is zero.
  • The tangent grows without limit near 90°90°, so that zero signals 90°90°: the rule for the slope of perpendicular lines.

And a vertical line?

  • A vertical line has no slope but has inclination 90°90°.
  • It meets a line of inclination α\alpha at 90°−α90° - \alpha (or α−90°\alpha - 90° if α\alpha is obtuse).
  • A line of slope 13\frac{1}{\sqrt{3}} has α=30°\alpha = 30°, so it meets a vertical line at 60°60°.
the parallel, perpendicular and vertical special cases of the angle between two lines
Three panels. Parallel lines with slope 1/2 each, where tan θ = 0 and θ = 0°. Perpendicular lines with slopes 2 and −1/2 meeting at 90°, where 1 + m₁m₂ = 0. A vertical line x = 1.6 crossed by a line of slope 1/√3 at 30 degrees to the x-axis, giving θ = 90° − 30° = 60°.

Try It Yourself

Use the coordinate lab to see Angle Between Two Lines at work: drag, change the numbers and watch what happens.

When the Lines Come in General Form

Substituting m=−abm = -\frac{a}{b} into the slope formula gives the general-form version.

  • A second route also handles vertical lines: (a,b)(a, b) is a normal (a perpendicular arrow) to ax+by+c=0ax + by + c = 0.
  • The angle between the normals equals the angle between the lines, using the angle between two vectors:
cos⁡θ=∣a1a2+b1b2∣a12+b12 a22+b22\cos\theta = \frac{|a_1 a_2 + b_1 b_2|}{\sqrt{a_1^2 + b_1^2}\,\sqrt{a_2^2 + b_2^2}}
  • For x−2y+2=0x - 2y + 2 = 0 and 3x+y−6=03x + y - 6 = 0: normals (1,−2)(1, -2) and (3,1)(3, 1) give cos⁡θ=150\cos\theta = \frac{1}{\sqrt{50}}, so θ≈81.87°\theta \approx 81.87°.
  • The slopes 12\frac{1}{2} and −3-3 give tan⁡θ=7\tan\theta = 7, the same angle.
the angle between two lines equals the angle between their normal vectors
The lines x − 2y + 2 = 0 and 3x + y − 6 = 0 crossing on a grid, each with its normal vector drawn as an arrow, (1, −2) and (3, 1). The angle between the lines and the angle between the normals both measure 81.87 degrees.

Three Lines Make a Triangle: A Built-In Check

Add y=−x+5y = -x + 5 to the two lines from the derivation, and the three enclose a triangle.

Pair of lines Slopes tan⁡θ\tan\theta θ\theta
first and second 33 and 0.50.5 11 45°45°
second and third 0.50.5 and −1-1 33 ≈71.57°\approx 71.57°
first and third 33 and −1-1 22 ≈63.43°\approx 63.43°
  • The angles add to 180°180°, as a triangle's must.
  • If three acute answers do not add to 180°180°, one corner is obtuse: use its supplement.
  • In the tool above, "Add a third line" lets you try this.

Examples of Angle Between Two Lines

Example 1

Find the acute angle between two lines with slopes m1=4m_1 = 4 and m2=1m_2 = 1.

  1. tan⁡θ=∣4−11+4∣=0.6\tan\theta = \left|\frac{4 - 1}{1 + 4}\right| = 0.6.
  2. θ=tan⁡−1(0.6)\theta = \tan^{-1}(0.6).

Final answer: θ≈30.96°\theta \approx 30.96°.

Example 2

Find the angle between 3x+4y−10=03x + 4y - 10 = 0 and 4x−5y+2=04x - 5y + 2 = 0.

  1. The formula written upside down gives tan⁡θ=831\tan\theta = \frac{8}{31} and 14.47°14.47°, but a sketch shows a near right angle.
  2. Use slopes −34-\frac{3}{4} and 45\frac{4}{5}: tan⁡θ=318\tan\theta = \frac{31}{8}.
  3. The flipped version gave the complement: 14.47°+75.53°=90°14.47° + 75.53° = 90°.

Final answer: θ≈75.53°\theta \approx 75.53°.

the correct angle of 75.53 degrees compared with the complement produced by flipping the formula
The lines 3x + 4y − 10 = 0 and 4x − 5y + 2 = 0 crossing at about (1.35, 1.48), with the acute angle θ = 75.53° marked, and a note that the flipped formula's arctan(8/31) = 14.47° is wrong.

Example 3

Two lines have slopes 23\frac{2}{3} and −32-\frac{3}{2}. Find the angle between them.

  1. The product is −1-1, so 1+m1m2=01 + m_1 m_2 = 0.

Final answer: θ=90°\theta = 90°; the lines are perpendicular.

Example 4

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

  1. m1=2m_1 = 2 and m2=1m_2 = 1.
  2. tan⁡θ=13\tan\theta = \frac{1}{3}. The lines meet at the origin.

Final answer: θ≈18.43°\theta \approx 18.43°.

finding the angle between two lines from two points on each
The blue line through (1, 2) and (4, 8) and the green line through (0, 0) and (5, 5) meeting at the origin, with the angle θ = 18.43° between them marked in orange.

Example 5

Find the acute angle between the vertical line x=3x = 3 and the line y=2x+1y = 2x + 1.

  1. The second line has α=tan⁡−12≈63.43°\alpha = \tan^{-1} 2 \approx 63.43°.
  2. θ=90°−63.43°=26.57°\theta = 90° - 63.43° = 26.57°. Normals (1,0)(1, 0) and (2,−1)(2, -1) agree. ✓

Final answer: θ≈26.57°\theta \approx 26.57°.

Example 6

A line through the origin makes a 45°45° angle with a line of slope 12\frac{1}{2}. Find every possible slope mm.

  1. ∣m−121+m2∣=1\left|\frac{m - \frac{1}{2}}{1 + \frac{m}{2}}\right| = 1, so m−12=±(1+m2)m - \frac{1}{2} = \pm\left(1 + \frac{m}{2}\right).
  2. The plus sign gives m=3m = 3; the minus sign gives m=−13m = -\frac{1}{3}.
  3. Dropping the absolute value loses the second answer.

Final answer: m=3m = 3 or m=−13m = -\frac{1}{3}.

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

Most slips involve the absolute value or the special cases.

Mistake 1: Dropping the absolute value

  • Where it slips in: Slopes with opposite signs, such as 2 and −3-3.
  • Don't do this: Report tan⁡θ=−1\tan\theta = -1 as −45°-45°.
  • The correct way: A negative fraction is the obtuse angle's tangent; keep the bars. Over 90°90° means use 180°−θ180° - \theta.

Mistake 2: Pushing the perpendicular case into a calculator

  • Where it slips in: Slopes such as 23\frac{2}{3} and −32-\frac{3}{2}.
  • Don't do this: Divide by zero and write "error".
  • The correct way: Check m1m2m_1 m_2 first. If it is −1-1, the answer is 90°90°.

Mistake 3: Using the slope formula with a vertical line

  • Where it slips in: Lines such as x=3x = 3.
  • Don't do this: Give the vertical line a slope of 0.
  • The correct way: A vertical line has no slope (slope 0 is horizontal). Use 90°−α90° - \alpha or normals.

Mistake 4: Mixing up the angle with its complement

  • Where it slips in: The general-form formula, written from memory.
  • Don't do this: Swap its top and bottom.
  • The correct way: A flipped formula gives 90°−θ90° - \theta (Example 2). Rebuild it from slopes and sketch; see parallel and perpendicular lines.

Why Does the Angle Between Two Lines Matter?

Anything that compares two directions uses it.

  • Road junctions. Slopes 0.250.25 and −2-2 give tan⁡θ=4.5\tan\theta = 4.5, so θ≈77.47°\theta \approx 77.47°. Near 90°90°, drivers see both ways.
  • Camera field of view. Edges of slopes 0.50.5 and −0.5-0.5 give about 53.13°53.13°.
  • Ramps. US accessibility standards cap a ramp at 1 in 12, only about 4.76°4.76° above level ground.
road junctions and camera fields of view use the angle between two lines
Two flat illustrations. Left: a main road with slope 0.25 and a side road with slope −2 crossing on green land, with the junction angle θ = 77.47° marked. Right: a camera whose field of view is bounded by dashed edges of slopes 0.5 and −0.5, with the 53.13 degree angle between them.

Conclusion

  • The angle between two lines is tan⁡θ=∣m1−m21+m1m2∣\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|, because each slope is the tangent of the line's inclination.
  • Slopes, line coefficients (or their normals) and 3D direction vectors all give the same angle.
  • Parallel lines give 0°0°, perpendicular lines 90°90°, and a vertical line needs 90°−α90° - \alpha.
  • 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

Check the slope refresher if any step feels shaky.

  1. Find the acute angle between lines with slopes 33 and −2-2.
  2. Find the angle between 2x−y+3=02x - y + 3 = 0 and x+2y−1=0x + 2y - 1 = 0.
  3. Find the angle between the 3D lines with direction vectors (1,0,1)(1, 0, 1) and (0,1,1)(0, 1, 1).

Answer to Question 1: tan⁡θ=∣5−5∣=1\tan\theta = \left|\frac{5}{-5}\right| = 1, so θ=45°\theta = 45°.

Answer to Question 2: the slopes 22 and −12-\frac{1}{2} multiply to −1-1, so θ=90°\theta = 90°.

Answer to Question 3: cos⁡θ=12 2=12\cos\theta = \frac{1}{\sqrt{2}\,\sqrt{2}} = \frac{1}{2}, so θ=60°\theta = 60°.

If Question 1 came out as −45°-45° or 135°135°, go back to the absolute-value section.

Want a live Bhanzu trainer to walk through more angle-between-lines problems with your child? Book a free demo class, online globally, or in person at our McKinney, TX center.

Read More

Research Behind This Article

  1. OpenStax, Precalculus 2e, Section 7.2: Sum and Difference Identities. openstax.org
  2. OpenStax, Calculus Volume 3, Section 2.3: The Dot Product. openstax.org
  3. U.S. Access Board, ADA Accessibility Standards, Section 405.2 (maximum ramp running slope of 1:12). access-board.gov
  4. OpenStax, Precalculus 2e, Section 2.2: Graphs of Linear Functions (slopes of parallel and perpendicular lines). openstax.org

Quick Quiz: Check Yourself

Three levels, questions with figures, instant feedback with the reason.

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

Can the angle between two lines be negative?
No. It is a size from 0°0° to 90°90°, and the absolute value in the formula makes sure of that.
What is the angle between two parallel lines?
0°0°. Their slopes are equal, so tan⁡θ=0\tan\theta = 0.
Why is the angle between perpendicular lines not given by the formula directly?
Because tan⁡90°\tan 90° does not exist. When m1m2=−1m_1 m_2 = -1 the denominator is zero, the formula's signal for 90°90°.
What if one line is vertical?
Use 90°90° minus the other line's inclination, or the normal-vector formula, as in Example 5.
How do you find the angle between two lines in 3D?
Use the direction vectors: cos⁡θ=∣a⃗⋅b⃗∣∣a⃗∣ ∣b⃗∣\cos\theta = \frac{|\vec{a}\cdot\vec{b}|}{|\vec{a}|\,|\vec{b}|}. Lines in space can miss each other, so the angle is defined by direction.
What is the angle between a line and the x-axis?
Its inclination, α=tan⁡−1m\alpha = \tan^{-1} m (or 180°−α180° - \alpha for the acute angle when the slope is negative).
✍️ Written By
Vaishali Tomar
Vaishali Tomar
Subject Matter Expert
Vaishali Tomar is an educator and content specialist with over four years of experience teaching and developing learning resources for students from UKG to Grade 8. At Bhanzu, she creates lesson plans, assessments and educational content that simplify math through structured, student-friendly learning. She holds an M.Sc. in Computer Science and co-founded Qeemle, an online magazine, during her college years, which built her skills in content creation and editing.
LinkedIn
🔬 Reviewed By
Shikha Sharma
Subject Matter Expert
Book a FREE Demo ClassBook Now →