In this explainer, we will learn how to find the angle between two straight lines in three dimensions using the formula.
That is, given two lines in three-dimensional space, we can use the formula for the scalar product of their two direction vectors to find the angle between the two lines. We rearrange the formula to find the cosine of the angle between the direction vectors and then take the inverse cosine to find the angle between the two lines. We will also see how the direction cosines of two straight lines may be used to find the same angle.
To begin with, we recall that a single straight line is specified uniquely in space either if it passes through a known fixed point and has a known direction, as in diagram 1 below, or if the line passes through two known fixed points, as in diagram 2.
In the first case, the line, which has direction vector , passes through the point , which has position vector . If is any point on this line and is the position vector of , then is the vector equation of the line. Here, is a scalar and each value of gives the position vector of one unique point on the line. Expanding on this, recall that we can express the equation of a line in three dimensions in the following ways.
Definition
In general, we can write the equation of a line parallel to the direction vector (where , , and are the unit vectors in the , , and directions) and passing through the point as
The point with coordinates is one of infinitely many points on the line and , , and are called the direction ratios.
In the second case (diagram 2), for a line passing through two known fixed points and with associated vectors and , the direction vector of this line is given by . That is,
The direction ratios are then , and using either of or as a fixed point, we can again write the line in vector, parametric, or Cartesian form.
Now suppose we have two lines in space, and .
If has direction vector and passes through the point and has direction vector and passes through the point , in vector form, these lines have the equations
The angle between the two lines is then the angle between their direction vectors, and . It does not depend on their positions, so in fact if we know the direction vectors of the lines we can find the angle between them. Drawing each of and from a common point, we can find the angle between them by rearranging the formula for the scalar product of the two vectors.
Definition: Using Direction Vectors to Find the Angle between Two Lines in Space
Given the direction vectors, and , of two lines in space, the cosine of the angle, , between the two lines is given by where, by definition, we calculate the smallest angle between the two lines, taking the absolute value of the dot product (the numerator). Taking the inverse cosine of both sides, we then find
What this means in practice is that for any two given lines in space, if we know the direction vector for each line, we can find the angle between the two lines using this formula.
We may also use the direction cosines of two lines to find the angle between them, where the direction cosines of a line in space are defined as follows.
Definition: Direction Cosines
Given a vector , the direction angles of the vector, that is, , are the angles that the vector makes with the positive , , and axes respectively. The direction cosines of the vector are then given by
The direction cosines of a line have the following property:
With the following definition, we can find the angle between two lines in space using their direction cosines.
Definition: Finding the Angle between Two Lines in Space Using Their Direction Cosines
If and are the direction cosines for two lines in space, and , then the cosine of the acute angle, , between the two lines is
The examples that follow demonstrate how our rearranged scalar product formula works when we have the equations of two lines in various forms and then demonstrate how we use the direction cosines to find the angle between two lines. In our first example, we are given the direction ratios of two lines.
Example 1: Determining the Measure of the Angle between Two Lines with Given Direction Ratios
Determine, to the nearest second, the measure of the angle between the two lines that have direction ratios of and .
Answer
We are given the direction ratios of two lines, which we will call and . Recalling that the direction ratios are the coefficients of the , , and components of the direction vector, for and we have direction vectors where , , and are the unit vectors in the , , and directions.
We know that the angle between two lines with direction vectors and is given by the formula where denotes the absolute value of the scalar product of vectors and , is the magnitude of a vector , and is the magnitude of a vector .
For our lines and , the scalar product of their direction vectors is
Hence, the absolute value is 25. The magnitude of is and the magnitude of vector is
In our formula for the cosine of the angle between the direction vectors, we then have
Taking the inverse cosine on both sides gives us our angle
We are asked to find the measure of the angle to the nearest second and to find this we recall that there are 60 minutes in one degree and 60 seconds in one minute. We therefore multiply the decimal part of our degrees by 60: . So we have (minutes) and multiplying the decimal part of our minutes by 60: (seconds).
Then, to the nearest second, the angle between the two lines and is .
In our next example, we will see how to find the angle between two lines given the coordinates of two points on each line.
Example 2: Finding the Measure of the Angle between Two Straight Lines in Three Dimensions given the Coordinates of Four Points Lying on Them
A straight line passes through the two points and , and a straight line passes through the two points and . Find the measure of the angle between the two lines, giving your answer to two decimal places if necessary.
Answer
For our first line , we begin by finding its direction ratios from which we can form its direction vector. We can do this by subtracting the coefficients for the , , and components of the first point from those of the second point . So the direction vector for is where , , and are the unit vectors in the , , and directions. Similarly using the points and on the second line , we have the direction vector
To find the angle between the lines and , we can use the formula for the absolute value of the scalar product of the two direction vectors, which is rearranged to give
This means that to find our angle , we will need to find the scalar product of the direction vectors and their magnitudes and . The scalar product is given by
The absolute value, , is therefore 120. The magnitude of is and the magnitude of vector is
In our formula for the cosine of the angle between the direction vectors, we then have
Taking the inverse cosine on both sides gives us our angle
Then, to two decimal places, the angle between the two lines and is .
It is worth noting that by taking the absolute value of the scalar product of the direction vectors in our formula, we ensure that we find the acute angle between our two lines. However, between two straight lines (which are neither perpendicular nor parallel), there are, in fact, two angles, one acute () and one obtuse ():
The acute angle is the smaller angle enclosed between the positive senses of the two direction vectors, as in diagram 1 below.
If our direction vectors are in opposite directions, as in diagram 2, then using the formula without the absolute value of the scalar product to calculate the angle between the two lines will give us the obtuse angle . This is why we take the absolute value, since the angle we seek is the smaller of the two. Equally valid, though requiring a little more work, we could subtract our obtuse angle from to obtain the acute angle.
This idea is illustrated in our next example.
Example 3: Finding the Measure of the Angle between Two Straight Lines given Their Equations in Three Dimensions
Find the measure of the angle between the two straight lines and , and round it to the nearest second.
Answer
To find the angle between two lines in space, since the angle between them is the angle between their direction vectors, we first find their direction vectors. We can then use the formula below to find the angle between the two lines:
In our case, we have one line. , given in parametric form: and the other, , given in Cartesian form: where is a scalar, and the line passes through the point , with direction vector .
Our line is
And comparing to the general parametric form we can see that if corresponds to , then , and . These are our direction ratios and our direction vector is therefore
Note that to find the angle between the two lines, it is not necessary for us to specify the points and through which the lines pass. Although in this case we can simply read this off from our equation as .
Now we consider our second line :
Since in each of the numerators the coefficients of , , and are equal to 1, comparing with the general Cartesian form, we may again simply read off the values of the direction ratios , , and . These are
Our direction vector for the line is therefore
We can now calculate the scalar product of the direction vectors, , and their magnitudes and to use in the formula for the cosine of the angle between the two lines.
The scalar product is
The absolute value of this, which we require for our formula, is . The magnitude of is and the magnitude of is
With these values in our formula, we have
Taking the inverse cosine on both sides then gives us our angle
Had we not taken the absolute value of the scalar product of the direction vectors, the cosine of our angle would have been negative. Our knowledge of trigonometry tells us that taking the inverse cosine of a negative number will give an obtuse angle, that is, an angle greater than . What we want, however, is the acute angle between the two lines and this is why we take the absolute value of the scalar product. An alternative to this would be to first take the inverse cosine of our negative result, obtaining
Then, to find our acute angle, we subtract this result from :
To find the minutes and seconds of this angle, we successively multiply the decimal part by 60 as follows:
Hence, the measure of the angle between the two lines and is .
In our next example, we demonstrate how to find the angle between two lines in space, given their Cartesian equations.
Example 4: Finding the Measure of the Angle between Two Straight Lines
Find, to the nearest second, the measure of the angle between the two straight lines and .
Answer
We are given two straight lines in space which we denote and :
The lines are defined in their Cartesian form, that is, in the form where lies on the line, , , and are the direction ratios, and the line has direction vector (where , , and are the unit vectors in the , , and directions).
To find the angle between our two lines and , we will use the formula
We will therefore need to know the direction ratios (, , and ) for our two lines and we can find these by comparing the three terms in the general Cartesian form given above with those in each of our two lines.
Beginning with the line , we have
Comparing the terms first: and comparing coefficients, we have
If we solve the first equation for we find that . Next, solving the second equation for the constant terms, we find . Following the same procedure for the and terms gives us and
Since , we know that the line passes through the point . And with our values of , , and , we know that has the direction vector .
Following exactly the same procedure for our second line , we find that this line also passes through the point (since ), and that therefore has the direction vector .
We can now use our direction vectors to determine the angle between the two lines using the formula above, with the absolute value of the scalar product and the magnitudes of our two direction vectors. Our scalar product is
Its absolute value, , is therefore . The magnitude of is and the magnitude of vector is
With these values in the formula, we then have
If we now take the inverse cosine on both sides, we have
However, we are not quite finished yet, since we are asked to find the angle to the nearest second. To do this, we recall that there are 60 minutes in one degree and 60 seconds in one minute. We therefore multiply the decimal part of our degrees by 60: . So we have (minutes) and multiplying the decimal part of our minutes by 60 gives us (seconds). Then, to the nearest second, the angle between the two lines and is .
In our final example, we will use the direction cosines to find the angle between two lines in space.
Example 5: Finding the Measure of the Angle between Two Straight Lines Using Their Direction Cosines
Find, to the nearest second, the measure of the angle between a straight line with direction ratio and a line with direction angles ).
Answer
We are given the direction ratio of one line, which we will call , and the direction angles of a second line, . To find the measure of the angle between these two lines, we will use the formula where and are the direction cosines for our two lines, and . Before we can do this, however, we will need to find the direction cosines for our two lines. Beginning with , we have the direction ratio, . The direction cosine for the component is given by where is the angle the direction vector of the line makes with the -axis. In our case,
Rationalizing the denominator, we then have , and following the same procedure for our and components, we find and . Hence, for , the direction cosines are
For our second line, , we have the direction angles ), so we simply take the cosines of these angles to find the direction cosines. For ease of calculation, we first convert the direction angle in the -direction into decimal form as follows:
The direction cosines for are then
The cosine of the angle between our two lines is then given by
Now, taking the inverse cosine of both sides of our equation, we find
Finally, converting to degrees, minutes, and seconds by successively multiplying the decimal parts by 60: , and . Hence, to the nearest second, the measure of the angle between the two lines is .
We complete our discussion of the angle between two lines in space by noting some key points.
Key Points
- The angle between two lines in space is the angle between their direction vectors and .
- The cosine of the angle is given by
- For two lines in space, and , with direction cosines and , the cosine of the acute angle, , between the two lines is
- If the lines are perpendicular, then and .
- If the lines are parallel, then and or .