Calculate Angle Between Two Lines

Online calculator for calculating the intersection angle of two lines in the coordinate system

Line Angle Calculator

Intersection Angle of Two Lines

Calculates the angle α between two lines in the coordinate system through vector calculation or slope comparison.

First Line (through points A and B)
X-coordinate of point A
Y-coordinate of point A
X-coordinate of point B
Y-coordinate of point B
Second Line (through points C and D)
X-coordinate of point C
Y-coordinate of point C
X-coordinate of point D
Y-coordinate of point D
Result
Intersection angle α:

Visualization

Angle between two lines

The graphic shows two intersecting lines with the calculated intersection angle.
The smaller of the two angles is output as the result (0° to 90°).

What is the Angle Between Two Lines?

The intersection angle between two lines is the smaller of the two angles that are created when they intersect:

  • Acute angle: Always between 0° and 90°
  • Unique: The smaller of the four resulting angles
  • Symmetry: Order of lines doesn't matter
  • Parallel lines: Angle = 0°
  • Perpendicular lines: Angle = 90°
  • Calculation: Via vectors or slopes

Calculation via Vector Analysis

The exact calculation is done using the direction vectors of the two lines:

Direction Vectors
\[\vec{u} = \begin{pmatrix} x_2-x_1 \\ y_2-y_1 \end{pmatrix}, \vec{v} = \begin{pmatrix} x_4-x_3 \\ y_4-y_3 \end{pmatrix}\]

Direction vectors of both lines

Angle Formula
\[\cos(\alpha) = \frac{|\vec{u} \cdot \vec{v}|}{|\vec{u}| \cdot |\vec{v}|}\]

Cosine of the intersection angle

Alternative Calculation via Slopes

The angle can also be calculated using the slopes of the two lines:

Calculate slopes
\[m_1 = \frac{y_2-y_1}{x_2-x_1}, \quad m_2 = \frac{y_4-y_3}{x_4-x_3}\]

Slopes of both lines

Angle from slopes
\[\alpha = \left|\arctan(m_1) - \arctan(m_2)\right|\]

Difference of slope angles

Formulas for Intersection Angle

Main Formula - Angle via Vectors
\[\alpha = \arccos\left(\frac{|\vec{u} \cdot \vec{v}|}{|\vec{u}| \cdot |\vec{v}|}\right)\]

Angle between direction vectors (always acute angle through absolute value)

Calculate dot product
\[\vec{u} \cdot \vec{v} = u_x \cdot v_x + u_y \cdot v_y\]

Dot product of direction vectors

Calculate vector magnitudes
\[|\vec{u}| = \sqrt{u_x^2 + u_y^2}\]

Length of direction vectors

Slope formula
\[\alpha = \left|\arctan\left(\frac{m_2-m_1}{1+m_1 \cdot m_2}\right)\right|\]

Angle via slope difference

Special cases
\[m_1 \cdot m_2 = -1 \Rightarrow \alpha = 90°\]

Perpendicular lines

Example

Example Calculation
A(-1,-2) B(4,5) C(2,-1) D(7,2)
Direction vectors
\[\vec{u} = \begin{pmatrix} 5 \\ 7 \end{pmatrix}, \vec{v} = \begin{pmatrix} 5 \\ 3 \end{pmatrix}\]

Differences of coordinates

Dot product
\[\vec{u} \cdot \vec{v} = 5 \cdot 5 + 7 \cdot 3 = 46\]

Calculate dot product

Magnitudes
\[|\vec{u}| = \sqrt{74} \approx 8.6\] \[|\vec{v}| = \sqrt{34} \approx 5.83\]

Calculate vector lengths

Result
\[\alpha = \arccos\left(\frac{46}{8.6 \cdot 5.83}\right) \approx 23.46°\]

The intersection angle is approximately 23.46°

Understanding Intersection Angles of Two Lines

The intersection angle between two lines is an important concept in analytical geometry. It describes the smaller of the two angles that are created when two lines intersect at a point. This angle always lies between 0° and 90°.

Mathematical Foundations

There are various methods for calculating the intersection angle:

1. Vector Analysis (preferred method)

The most exact method uses the direction vectors of the two lines. For line 1 through A(x₁,y₁) and B(x₂,y₂) and line 2 through C(x₃,y₃) and D(x₄,y₄), the direction vectors are:

\[\vec{u} = \begin{pmatrix} x_2-x_1 \\ y_2-y_1 \end{pmatrix}, \quad \vec{v} = \begin{pmatrix} x_4-x_3 \\ y_4-y_3 \end{pmatrix}\]

The angle then results from the dot product:

\[\alpha = \arccos\left(\frac{|\vec{u} \cdot \vec{v}|}{|\vec{u}| \cdot |\vec{v}|}\right)\]
2. Slope Calculation

Alternatively, the angle can be calculated using the slopes m₁ and m₂ of the two lines:

\[\alpha = \left|\arctan\left(\frac{m_2-m_1}{1+m_1 \cdot m_2}\right)\right|\]

Important Properties

Acute Angle

The intersection angle is always the smaller of the four resulting angles, i.e., between 0° and 90°.

Symmetry

The order of lines doesn't matter. The angle between line 1 and 2 equals the angle between 2 and 1.

Uniqueness

For each pair of lines, there is exactly one intersection angle (except for parallel lines).

Complementary Angles

The two intersection angles add up to 180°. We use the smaller one.

Special Cases

Parallel Lines

Angle = 0°
Same slope: m₁ = m₂

Perpendicular Lines

Angle = 90°
Slopes: m₁ · m₂ = -1

45° Angle

Occurs when one slope is the negative reciprocal of the other

Practical Applications

The calculation of intersection angles is found in many areas:

  • Architecture: Roof slopes, building angles, construction drawings
  • Mechanical engineering: Joint angles, cutting angles of components
  • Surveying: Angles between survey lines, boundary courses
  • Navigation: Course angles, bearing angles
  • Computer graphics: Collision detection, 3D rendering
  • Optics: Reflection and refraction angles

Mathematical Background

The dot product used for angle calculation is a fundamental concept of linear algebra. It measures both the "similarity" of directions and the lengths of the vectors. The cosine of the angle corresponds to the dot product normalized to the lengths.

Using the absolute value in the dot product ensures that the acute angle is always calculated, regardless of the orientation of the direction vectors.

Is this page helpful?            
Thank you for your feedback!

Sorry about that

How can we improve it?


More graphics functions

Angle of two lines  •  Angle of two vectors  •  Center of a straight line  •  Distance of two points  •  Distance of a point and a line  •  Rise over Run  •  Slope of a line  •  Straight line equation  •  Circular arc  •  Helix  •  Koch snowflake  •