Lesson Explainer: Angle between Two Straight Lines in Space Mathematics

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 𝑟=𝑥𝑖+𝑦𝑗+𝑧𝑘+𝜆𝑎𝑖+𝑏𝑗+𝑐𝑘,𝑥=𝑥+𝜆𝑎,𝑦=𝑦+𝜆𝑏,𝑧=𝑧+𝜆𝑐,𝑥𝑥𝑎=𝑦𝑦𝑏=𝑧𝑧𝑐().(vectorform)(parametricform)Cartesianformor

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 𝑑𝑑=𝑑𝑑𝜃𝜃=𝑑𝑑𝑑𝑑,coscos 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 𝜃=𝑑𝑑𝑑𝑑,0𝜃90.cos

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 𝑙=𝛼=𝑎𝑎+𝑏+𝑐,𝑚=𝛽=𝑏𝑎+𝑏+𝑐,𝑛=𝛾=𝑐𝑎+𝑏+𝑐.coscoscos

The direction cosines of a line have the following property: coscoscos𝛼+𝛽+𝛾=1.

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 cos𝜃=|𝑙𝑙+𝑚𝑚+𝑛𝑛|.

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 (4,3,4) and (3,3,1).

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 𝑑=4𝑖3𝑗4𝑘,𝑑=3𝑖3𝑗𝑘, 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 cos𝜃=𝑑𝑑𝑑𝑑, 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 𝑑𝑑=4𝑖3𝑗4𝑘3𝑖3𝑗𝑘=(4×3)+(3×3)+(4×1)=25.

Hence, the absolute value 𝑑𝑑 is 25. The magnitude of 𝑑 is 𝑑=(4)+(3)+(4)=41, and the magnitude of vector 𝑑 is 𝑑=(3)+(3)+(1)=19.

In our formula for the cosine of the angle 𝜃 between the direction vectors, we then have cos𝜃=254119.

Taking the inverse cosine on both sides gives us our angle 𝜃=25411926.39920173.cos

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: 0.39920173×6023.9521038. So we have 23.9521038 (minutes) and multiplying the decimal part of our minutes by 60: 0.9521038×6057.12657 (seconds).

Then, to the nearest second, the angle between the two lines 𝐿 and 𝐿 is 262357.

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 𝐴(2,2,3) and 𝐵(6,4,5), and a straight line 𝐿 passes through the two points 𝐶(1,4,1) and 𝐷(9,6,9). 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 𝐴(2,2,3) from those of the second point 𝐵(6,4,5). So the direction vector for 𝐿 is 𝑑=(6(2))𝑖+(42)𝑗+(5(3))𝑘=4𝑖6𝑗2𝑘, where 𝑖, 𝑗, and 𝑘 are the unit vectors in the 𝑥, 𝑦, and 𝑧 directions. Similarly using the points 𝐶(1,4,1) and 𝐷(9,6,9) on the second line 𝐿, we have the direction vector 𝑑=(91)𝑖+(64)𝑗+(91)𝑘=10𝑖10𝑗10𝑘.

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 cos𝜃=𝑑𝑑𝑑𝑑.

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 𝑑𝑑=4𝑖6𝑗2𝑘10𝑖10𝑗10𝑘=(4×10)+(6×10)+(2×10)=120.

The absolute value, 𝑑𝑑, is therefore 120. The magnitude of 𝑑 is 𝑑=(4)+(6)+(2)=56, and the magnitude of vector 𝑑 is 𝑑=(10)+(10)+(10)=300.

In our formula for the cosine of the angle 𝜃 between the direction vectors, we then have cos𝜃=12056300.

Taking the inverse cosine on both sides gives us our angle 𝜃=1205630022.2076.cos

Then, to two decimal places, the angle between the two lines 𝐿 and 𝐿 is 22.21.

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 180𝜃=180𝛼 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 𝐿𝑥=58𝑡,𝑦=34𝑡,𝑧=5+6𝑡 and 𝐿𝑥53=𝑦+56=𝑧22, 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: cos𝜃=𝑑𝑑𝑑𝑑.

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 𝐿𝑥=58𝑡,𝑦=34𝑡,𝑧=5+6𝑡.

And comparing to the general parametric form we can see that if 𝜆 corresponds to 𝑡, then 𝑎=8, 𝑏=4 and 𝑐=6. These are our direction ratios and our direction vector is therefore 𝑑=8𝑖4𝑗+6𝑘.

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 𝐴(5,3,5).

Now we consider our second line 𝐿: 𝐿𝑥53=𝑦+56=𝑧22.

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 𝑎=3,𝑏=6,𝑐=2.and

Our direction vector for the line 𝐿 is therefore 𝑑=3𝑖6𝑗2𝑘.

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 𝑑𝑑=8𝑖4𝑗+6𝑘3𝑖6𝑗2𝑘=(8×3)+(4×6)+(6×2)=12.

The absolute value of this, which we require for our formula, is 𝑑𝑑=12. The magnitude of 𝑑 is 𝑑=(8)+(4)+6=229, and the magnitude of 𝑑 is 𝑑=3+(6)+(2)=7.

With these values in our formula, we have cos𝜃=121429.

Taking the inverse cosine on both sides then gives us our angle 𝜃=12142980.84142565.cos

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 90. 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 𝜃=12142999.158574.cos

Then, to find our acute angle, we subtract this result from 180: 𝜃=180𝜃=18099.158574=80.841426.

To find the minutes and seconds of this angle, we successively multiply the decimal part by 60 as follows: 0.84142565×6050.485539000.48553900×6029.13234000.

Hence, the measure of the angle between the two lines 𝐿 and 𝐿 is 805029.

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 2𝑥=4𝑦=3𝑧 and 4𝑥=5𝑦=2𝑧.

Answer

We are given two straight lines in space which we denote 𝐿 and 𝐿: 𝐿2𝑥=4𝑦=3𝑧,𝐿4𝑥=5𝑦=2𝑧.

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 cos𝜃=𝑑𝑑𝑑𝑑.

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 𝐿2𝑥=4𝑦=3𝑧,𝑥𝑥𝑎=𝑦𝑦𝑏=𝑧𝑧𝑐.GeneralCartesianform

Comparing the 𝑥 terms first: 2𝑥=𝑥𝑥𝑎=𝑥𝑎𝑥𝑎, and comparing coefficients, we have 𝑥2=1𝑎,0=𝑥𝑎.constant

If we solve the first equation for 𝑎 we find that 𝑎=12. Next, solving the second equation for the constant terms, we find 𝑥=0. Following the same procedure for the 𝑦 and 𝑧 terms gives us 𝑥=𝑦=𝑧=0 and 𝑎=12,𝑏=14,𝑐=13.and

Since 𝑥=𝑦=𝑧=0, we know that the line 𝐿 passes through the point (0,0,0). And with our values of 𝑎, 𝑏, and 𝑐, we know that 𝐿 has the direction vector 𝑑=12𝑖+14𝑗13𝑘.

Following exactly the same procedure for our second line 𝐿, we find that this line also passes through the point (0,0,0) (since 𝑥=𝑦=𝑧=0), and that 𝑎=14,𝑏=15,𝑐=12.and𝐿 therefore has the direction vector 𝑑=14𝑖15𝑗+12𝑘.

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 𝑑𝑑=12𝑖+14𝑗13𝑘14𝑖15𝑗+12𝑘=12×14+14×15+13×12=11120.

Its absolute value, 𝑑𝑑, is therefore 11120. The magnitude of 𝑑 is 𝑑=12+14+13=6112, and the magnitude of vector 𝑑 is 𝑑=14+15+12=14120.

With these values in the formula, we then have cos𝜃=×=2261141.

If we now take the inverse cosine on both sides, we have 𝜃=226114176.27757930.cos

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: 0.27757930×6016.654758. So we have 16.654758 (minutes) and multiplying the decimal part of our minutes by 60 gives us 0.654758×6039.285539 (seconds). Then, to the nearest second, the angle between the two lines 𝐿 and 𝐿 is 761639.

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 (5,3,2) and a line with direction angles (47,111,502330).

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 cos𝜃=|𝑙𝑙+𝑚𝑚+𝑛𝑛|, 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, (5,3,2). The direction cosine for the 𝑥 component is given by 𝑙=𝛼=𝑎𝑎+𝑏+𝑐,cos where 𝛼 is the angle the direction vector of the line makes with the 𝑥-axis. In our case, 𝑙=𝛼=55+3+2=538.cos

Rationalizing the denominator, we then have 𝑙=53838, and following the same procedure for our 𝑦 and 𝑧 components, we find 𝑚=33838 and 𝑛=23838. Hence, for 𝐿, the direction cosines are (𝑙,𝑚,𝑛)=53838,33838,23838.

For our second line, 𝐿, we have the direction angles (47,111,502330), 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: 502330=50+2360+30360050.39167.

The direction cosines for 𝐿 are then (𝑙,𝑚,𝑛)=((47),(111),(50.39167)).coscoscos

The cosine of the angle between our two lines is then given by coscoscoscos𝜃=|𝑙𝑙+𝑚𝑚+𝑛𝑛|=|||53838(47)+33838(111)+23838(50.39167)|||0.585612835.

Now, taking the inverse cosine of both sides of our equation, we find 𝜃=(0.585612835)54.15370420.cos

Finally, converting to degrees, minutes, and seconds by successively multiplying the decimal parts by 60: 0.15370420×609.222252, and 0.222252×6013.335. Hence, to the nearest second, the measure of the angle between the two lines is 𝜃=54913.

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 cos𝜃=𝑑𝑑𝑑𝑑.
  • For two lines in space, 𝐿 and 𝐿, with direction cosines (𝑙,𝑚,𝑛) and (𝑙,𝑚,𝑛), the cosine of the acute angle, 𝜃, between the two lines is cos𝜃=|𝑙𝑙+𝑚𝑚+𝑛𝑛|.
  • If the lines are perpendicular, then 𝑑𝑑=0 and 𝜃=90.
  • If the lines are parallel, then 𝑑𝑑=±𝑑𝑑 and 𝜃=0 or 180.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.