How Do You Calculate the Distance Between Two Skew Lines?

  • MHB
  • Thread starter Petrus
  • Start date
  • Tags
    Lines
In summary: This would be my way of continuing:We begin with the two lines$$l_1: (x,y,z) = (1,1,3)+t(1,-2,-3)$$$$l_2: (x,y,z) = (6,5,0)+s(-3,0,1)$$Now, take any two points on the line, and find the vector going from one to the other. Let's define $P_1=(1,1,3)$ and $P_2=(6,5,0)$. The vector connecting them is then$$v = P_2 - P_1 = \langle
  • #1
Petrus
702
0
Hello MHB,
This is a problem from my book,
calculate distance between line \(\displaystyle l_1: (x,y,z) = (1,1,3)+t(1,-2,-3)\) and
b49o3l.png


(hope it work's read \(\displaystyle l_2\) cause I don't know how to write that in latex)
I am stuck when I got \(\displaystyle l_2\) in plane.
I start with \(\displaystyle l_1\)
\(\displaystyle P=(1+t,1-2t,3-3t)\)
what shall I do with \(\displaystyle l_2\)?

Regards,
\(\displaystyle |\pi\rangle\)
 
Last edited:
Physics news on Phys.org
  • #2
Petrus said:
Hello MHB,
This is a problem from my book,
calculate distance between line \(\displaystyle l_1: (x,y,z) = (1,1,3)+t(1,-2,-3)\) and
b49o3l.png


(hope it work's read \(\displaystyle l_2\) cause I don't know how to write that in latex)
I am stuck when I got \(\displaystyle l_2\) in plane.
I start with \(\displaystyle l_1\)
\(\displaystyle P=(1+t,1-2t,3-3t)\)
what shall I do with \(\displaystyle l_2\)?

Regards,
\(\displaystyle |\pi\rangle\)

Hey I pi rangle! ;)

Which methods do you know to determine the distance between 2 lines?

What you can do for instance with \(\displaystyle l_2\) is find a support vector and a direction vector, so you can define a point Q similar to your point P with 1 parameter.

If you click Reply With Quote you can see how I put your set of equations in $\LaTeX$.
$$l_2:
\left\{
\begin{aligned}
x-\phantom{1}y+3z-1 &= 0 \\
-2x + 3y -6z - 3 &= 0 \\
\end{aligned}
\right.$$
 
  • #3
I like Serena said:
Hey I pi rangle! ;)

Which methods do you know to determine the distance between 2 lines?

What you can do for instance with \(\displaystyle l_2\) is find a support vector and a direction vector, so you can define a point Q similar to your point P with 1 parameter.

If you click Reply With Quote you can see how I put your set of equations in $\LaTeX$.
$$l_2:
\left\{
\begin{aligned}
x-\phantom{1}y+3z-1 &= 0 \\
-2x + 3y -6z - 3 &= 0 \\
\end{aligned}
\right.$$
Hello I like Serena!
Thanks for showing me the latex code!:)
I know two method one when you do from point to plane which I don't prefer. The method I always use that we is calculate the distance between a vector \(\displaystyle |PQ|\)
this parameter I am unsure with what I shall use.

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #4
Petrus said:
Hello I like Serena!
Thanks for showing me the latex code!:)
I know two method one when you do from point to plane which I don't prefer. The method I always use that we is calculate the distance between a vector \(\displaystyle |PQ|\)
this parameter I am unsure with what I shall use.

Regards,
\(\displaystyle |\pi\rangle\)

Can you solve for instance x and y from the set of equations (leaving z as an unknown)?
 
  • #5
I like Serena said:
Can you solve for instance x and y from the set of equations (leaving z as an unknown)?
Hello I like Serena
I get y=5 and \(\displaystyle x=4-3z\)

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #6
Petrus said:
Hello I like Serena
I get y=5 and \(\displaystyle x=4-3z\)

Regards,
\(\displaystyle |\pi\rangle\)

Let's see...

We have $x−y+3z−1=0$.
Substituting your solution, I get:

$$(4-3z)-(5)+3z-1 =0 \\
-2=0 $$

That can't be right!
 
  • #7
I like Serena said:
Let's see...

We have $x−y+3z−1=0$.
Substituting your solution, I get:

$$(4-3z)-(5)+3z-1 =0 \\
-2=0 $$

That can't be right!
Hello I like Serena
I made some typo sorry!
\(\displaystyle y=5 \) and \(\displaystyle x=6-3z\)

Regards,
\(\displaystyle |\pi\rangle\)
 
Last edited:
  • #8
Petrus said:
Hello I like Serena
I made some typo sorry!
\(\displaystyle y=5 \) and \(\displaystyle x=6-3z\)

Regards,
\(\displaystyle |\pi\rangle\)

Good!

Now point $Q$ can be expressed for instance as $(6-3z, 5, z)$.
Or I might also say that $l_2$ is $(6,5,0)+s(-3,0,1)$.

There are a couple of ways to proceed.
Perhaps you already know a way?
 
  • #9
I like Serena said:
Good!

Now point $Q$ can be expressed for instance as $(6-3z, 5, z)$.
Or I might also say that $l_2$ is $(6,5,0)+s(-3,0,1)$.

There are a couple of ways to proceed.
Perhaps you already know a way?
Hello I like Serena,
Is my method not valid or I am doing something wrong cause I don't get same answer as facit...
We got that
\(\displaystyle PQ=(5-3z-t,4+2t,z-3+3t)\)
We know that \(\displaystyle PQ*(1,-2,-3)=0\) and \(\displaystyle PQ*(-3,0,1)=0\)
then I get this equation
\(\displaystyle 6t+10z=-18\)
\(\displaystyle 14t+6z=6\)
and we get \(\displaystyle t=-\frac{6}{13}\), \(\displaystyle z=\frac{27}{13}\)
that means \(\displaystyle PQ=(-\frac{10}{13},\frac{40}{13},-\frac{30}{13})\)
but this is wrong, and I can't see where..

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #10
Petrus said:
We got that
\(\displaystyle PQ=(5-3z-t,4+2t,z-3+3t)\)
We know that \(\displaystyle PQ*(1,-2,-3)=0\) and \(\displaystyle PQ*(-3,0,1)=0\)

Good.

then I get this equation
\(\displaystyle 6t+10z=-18\)
\(\displaystyle 14t+6z=6\)

I don't. How did you get it?
 
  • #11
I like Serena said:
Good.
I don't. How did you get it?
Hello I like Serena
\(\displaystyle 5-3z-t-2(4+2t)-3(z-3+3t)=0\)
\(\displaystyle -3(5-3z-t)+z-3+3t=0\)

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #12
Hello,
Now I get this equation if I have not made any misscalculation...
\(\displaystyle -6z-14t=-6\)
\(\displaystyle -8z+6t=18\)
\(\displaystyle t=\frac{39}{37}\), \(\displaystyle z=-\frac{54}{37}\)

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #13
This would be my way of continuing:

We begin with the two lines
$$l_1: (x,y,z) = (1,1,3)+t(1,-2,-3)$$
$$l_2: (x,y,z) = (6,5,0)+s(-3,0,1)$$

Now, take any two points on the line, and find the vector going from one to the other. Let's define $P_1=(1,1,3)$ and $P_2=(6,5,0)$. The vector connecting them is then
$$v = P_2 - P_1 = \langle 5,4,-3\rangle$$

Now, you need the component of this vector that is perpendicular to either line. In order to do so, you need some unit vector perpendicular to both $l_1$ and $l_2$. An easy way to find one is to take and normalize the cross product of the line vectors
$$n = \langle 1,-2,-3\rangle \times \langle -3,0,1\rangle
= \langle -2,8,-6 \rangle$$
$$u = n/ \| n \| = \frac{1}{\sqrt{26}} \langle -1,4,-3 \rangle $$

To finish, we have

$$dist = \left| v \cdot u \right| = \left| \frac{1}{\sqrt{26}} ((-1)(5)+(4)(4)+(-3)(-3)) \right|
\\= \frac{20}{\sqrt{26}} \approx 3.92 $$

Is that anything like how you're supposed to do it?
 
Last edited:
  • #14
TheBigBadBen said:
This would be my way of continuing:

We begin with the two lines
$$l_1: (x,y,z) = (1,1,3)+t(1,-2,-3)$$
$$l_2: (x,y,z) = (6,5,0)+s(-3,0,1)$$

Now, take any two points on the line, and find the vector going from one to the other. Let's define $P_1=(1,1,3)$ and $P_2=(6,5,0)$. The vector connecting them is then
$$v = P_2 - P_1 = \langle 5,4,-3\rangle$$

Now, you need the component of this vector that is perpendicular to either line. In order to do so, you need some unit vector perpendicular to both $l_1$ and $l_2$. An easy way to find one is to take and normalize the cross product of the line vectors
$$n = \langle 1,-2,-3\rangle \times \langle -3,0,1\rangle
= \langle -2,8,-6 \rangle$$
$$u = n/ \| n \| = \frac{1}{\sqrt{26}} \langle -1,4,-3 \rangle $$

To finish, we have

$$dist = \left| v \cdot u \right| = \left| \frac{1}{\sqrt{26}} ((-1)(5)+(4)(4)+(-3)(-3)) \right|
\\= \frac{20}{\sqrt{26}} \approx 3.92 $$

Is that anything like how you're supposed to do it?
Hello,
Your method works fine so should my, I have done some with my method and it works, I don't understand what I am doing wrong

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #15
Petrus said:
Hello,
Your method works fine so should my, I have done some with my method and it works, I don't understand what I am doing wrong

Regards,
\(\displaystyle |\pi\rangle\)

Well, I can't tell you what you're doing wrong because I don't really understand your method. Why are you solving for z and t? What information are you looking for, and how does it tie into finding the distance between lines?
 
  • #16
TheBigBadBen said:
Well, I can't tell you what you're doing wrong because I don't really understand your method. Why are you solving for z and t? What information are you looking for, and how does it tie into finding the distance between lines?
Hello TheBigBadBen,
We want to find z and t so we know PQ, notice that P is on line 1 and Q is on line 2 so with other words Distance between two line is same as |PQ| the length of PQ

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #17
Petrus said:
Hello TheBigBadBen,
We want to find z and t so we know PQ, notice that P is on line 1 and Q is on line 2 so with other words Distance between two line is same as |PQ| the length of PQ

Regards,
\(\displaystyle |\pi\rangle\)

All right, now I see. You're saying that for any point P on line 1 and point Q on line 2, we can write the vector between those two points as

\(\displaystyle PQ=(5-3z-t,4+2t,z-3+3t)\)

Which is correct. Presumably, for the right choice of P and Q, we'd be able to say that the length of that vector is the distance between the two lines. Now, what you need to do (and I now see that this is what you were trying to do) is find such a PQ that is perpendicular to both of the lines. Thus, we need to satisfy
$$ PQ \cdot (1,-2,-3) = 0\\
PQ \cdot (-3,0,1) = 0$$
Which will yield a unique PQ connecting the lines. Finding the length of that should yield the correct answer.

Perfect. Now that I understand, I'll try to see where that went wrong.
 
  • #18
Petrus said:
Hello,
Now I get this equation if I have not made any misscalculation...
\(\displaystyle -6z-14t=-6\)
\(\displaystyle -8z+6t=18\)
\(\displaystyle t=\frac{39}{37}\), \(\displaystyle z=-\frac{54}{37}\)

Regards,
\(\displaystyle |\pi\rangle\)

Your equation is still not quite right.

Let's clean it up a bit.

\(\displaystyle \vec{PQ} = \begin{pmatrix}5\\4\\-3\end{pmatrix} + z \begin{pmatrix}-3\\0\\1\end{pmatrix} - t \begin{pmatrix}1\\-2\\-3\end{pmatrix}\)

Since $\vec{PQ} \perp \begin{pmatrix}1\\-2\\-3\end{pmatrix}$, we get:
$$(5-8+9)+z(-3-3)-t(1+4+9)=0$$
And since $\vec{PQ} \perp \begin{pmatrix}-3\\0\\1\end{pmatrix}$, we get:
$$(-15-3)+z(9+1)-t(-3-3)=0$$

Which equations do you get from that?
 
  • #19
I like Serena said:
Your equation is still not quite right.

Let's clean it up a bit.

\(\displaystyle \vec{PQ} = \begin{pmatrix}5\\4\\-3\end{pmatrix} + z \begin{pmatrix}-3\\0\\1\end{pmatrix} - t \begin{pmatrix}1\\-2\\-3\end{pmatrix}\)

Since $\vec{PQ} \perp \begin{pmatrix}1\\-2\\-3\end{pmatrix}$, we get:
$$(5-8+9)+z(-3-3)-t(1+4+9)=0$$
And since $\vec{PQ} \perp \begin{pmatrix}-3\\0\\1\end{pmatrix}$, we get:
$$(-15-3)+z(9+1)-t(-3-3)=0$$

Which equations do you get from that?
Hello I like Serena,
\(\displaystyle 6z+14t=6\)
\(\displaystyle 10z+9t=18\)
that means \(\displaystyle t=-\frac{24}{43}\) and \(\displaystyle z=\frac{99}{43}\)
that means \(\displaystyle PQ=(-\frac{58}{43},\frac{124}{43},-\frac{102}{43})\)
then we get the distance is and that is not the same as facit..

Regards,
\(\displaystyle |\pi\rangle\)
 
  • #20
Petrus said:
Hello I like Serena,
\(\displaystyle 6z+14t=6\)
\(\displaystyle 10z+9t=18\)
that means \(\displaystyle t=-\frac{24}{43}\) and \(\displaystyle z=\frac{99}{43}\)
that means \(\displaystyle PQ=(-\frac{58}{43},\frac{124}{43},-\frac{102}{43})\)
then we get the distance is and that is not the same as facit..

Regards,
\(\displaystyle |\pi\rangle\)

Can you try to simplify $(−15−3)+z(9+1)−t(−3−3)=0$ again?
 

FAQ: How Do You Calculate the Distance Between Two Skew Lines?

What is the formula for finding the distance between two lines?

The formula for finding the distance between two lines is:
d = |(ax1 + by1 + c)/√(a^2 + b^2)|
Where a and b are the coefficients of the x and y terms in the equations of the lines, and c is the constant term.

Can the distance between two lines be negative?

No, the distance between two lines is always a positive value. It represents the shortest distance between the two lines, and distance is always a positive quantity.

How is the distance between two parallel lines calculated?

The distance between two parallel lines can be calculated by finding the distance between a point on one line and the other line. This point can be chosen arbitrarily, and the distance can be calculated using the formula mentioned in the first question.

Is it necessary for the lines to be parallel to calculate their distance?

No, the lines do not have to be parallel for their distance to be calculated. The formula for finding the distance between two lines is applicable for any two non-coincident lines in a 2-dimensional plane.

Can the distance between two lines be zero?

Yes, the distance between two lines can be zero if the lines are coincident or if they intersect at one or more points. In this case, the lines are not considered to be parallel and the formula for calculating their distance is not applicable.

Back
Top