Calculate the angle between two lines
Online calculator for calculating the angle between two lines in the coordinate system
On this page the angle between two lines in a coordinate system is calculated. To do this, enter the X / Y coordinates of the two lines. It doesn't matter which point is first and which is second. The result will be the same.
|
Picture 1
Calculation of the angle by vector calculation
Lines with a common starting point
The angle between two straight lines with a common starting point can be determined by vector calculation. To determine the angle, the scalar product of the vectors and their magnitude must first be calculated.
Calculate scalar product
The scalar product for the two vectors
\( \vec{a}=\left(\matrix{a_1\\a_2} \right) \) and \(\vec{b}=\left(\matrix{b_1\\b_2}\right)\)is calculated according to the formula
\( \vec{a}·\vec{b}= a_1·b_1 + a_2·b_2 \)
The individual elements of the vectors are multiplied with one another and the products are added. The sum of the addition is the scalar product of the vector.
Picture 2
Calculate magnitude
The magnitude of a vector can be calculated using the Pythagorean theorem. After that, the square of the hypotenuse is equal to the sum of the squares of the legs.
The magnitude of the vector \( \left(\matrix{a_1\\a_2}\right)\) is calculated as \( \vec{|a|}=\sqrt{a_1^2+a_2^2}\)
Example
We are looking for the angle \(α\) between \( \left(\matrix{5\\7}\right)\) and \( \left(\matrix{5\\3}\right)\)
\(\vec{a} · \vec{b} = 5·5 + 7·3 = 25+21=46 \)
\(|\vec{a}|=\sqrt{5^2+7^2}=\sqrt{25+49}=\sqrt{74}=8.6 \)
\(|\vec{b}|=\sqrt{5^2+3^2}=\sqrt{25+9}=\sqrt{34}=5.83 \)
\(\displaystyle cos(α)=\frac{46}{8.6 ·5.83}= 0.91747\)
\(α=acos(0.91747)=23.44°\)
Lines without points of contact
If the lines do not have a common starting point, you can move them so that the starting points touch. If the two X or Y coordinates of a line are changed by the same value, they will shift in position. The direction and the angle do not change.
To move the two lines from Figure 3 to a common starting point, the vectors of the end points are simply subtracted.
\(\displaystyle a=\left( \matrix{4\\5}\right)-\left(\matrix{-1\\-2}\right)=\left( \matrix{4-(-1)\\5-(-2)}\right)=\left(\matrix{5\\7}\right)\)
\(\displaystyle b=\left( \matrix{7\\2}\right)-\left(\matrix{2\\-1}\right)=\left( \matrix{7-2\\2-(-1)}\right)=\left(\matrix{5\\3}\right)\)
By subtracting, we get two vectors as shown in Figure 2 above. Now the angle can be calculated as in example 1 above.
Picture 3
|