|


Distance Equations in Three Dimensions
Date: 11/26/1999 at 08:55:29
From: George
Subject: Distance Formulas in 3D
What's the formula that gives the distance between a point M(xo,yo,zo)
and a line that has an equation of the general type:
-- -- -- --
| | | |
| Ax + By + Cz + D | | 0 |
| | = | |
| Ex + Fy + Gz + H | | 0 |
| | | |
-- -- -- --
in three dimensions? Also, what formula gives the distance between two
lines that have equations:
-- -- -- --
| | | |
| Ax + By + Cz + D | | 0 |
| | = | |
| Ex + Fy + Gz + H | | 0 |
| | | |
-- -- -- --
and
-- -- -- --
| | | |
| Ix + Jy + Kz + L | | 0 |
| | = | |
| Mx + Ny + Pz + Q | | 0 |
| | | |
-- -- -- --
(general equations) in three dimensions? I would like to tell you how
I have tried to answer this myself, but it's very complicated.
Thank you very much.
Date: 11/26/1999 at 10:12:19 From: Doctor Rob Subject: Re: Distance Formulas in 3D Thanks for writing to Ask Dr. Math, George. The formula you seek can be found in the Analytic Geometry Formula area of the Dr. Math FAQ: http://mathforum.org/dr.math/faq/formulas/faq.analygeom_3.html#threelines You will need to understand determinants to use it. First you need to find the directions of the two lines and a point on each. To do that, use the formula for the line formed by the intersection of two planes given at the end of the section labeled "Planes" on the same web page. Then apply the formula for the distance between the two lines using the 3-by-3 determinant. I leave all the messy manipulations to you. - Doctor Rob, The Math Forum http://mathforum.org/dr.math/
Date: 11/26/1999 at 10:35:29
From: Doctor Anthony
Subject: Re: Distance Formulas in 3D
Below are a couple of examples showing the general method for finding
the shortest distance between two skew lines.
Example (1)
Suppose we have equations of the two lines:
r = (1,1,-6) + t(1,-2,0)
and
r = (1,2,-3) + s(1,0,-4)
The shortest distance between the lines is found by taking the scalar
product of the vector joining the two given points with the unit
vector of the common perpendicular.
The common perpendicular will be in direction:
|i j k| = i(8) - j(-4) + k(2)
|1 -2 0|
|1 0 -4|
= 8i + 4j + 2k
= 4i + 2j + k
as a unit vector this is (4i + 2j + k)/sqrt(21)
The vector joining the two given points is
[(1-1),(2-1),(-3+6)]
= [0,1,3]
and as shown above the unit vector perpendicular to the two given
lines is:
[4,2,1]/sqrt(21)
and the required scalar product is
(0+2+3)/sqrt(21)
= 5/sqrt(21)
This is the shortest distance between the lines.
The parametric equation of the line of shortest distance between the
given lines is found as follows:
The line of shortest distance will be from points
i(1+t) + j(1-2t) + k(-6+0t) on one line to
i(1+s) + j(2+0s) + k(-3-4s) on the second line
That is
i(1+t-1-s) + j(1-2t-2) + k(-6+3+4s)
i(t-s) + j(-1-2t) + k(-3+4s)
and this will be parallel to 4i + 2j + k
that is:
t-s -1-2t -3+4s
--- = ----- = -----
4 2 1
From the first equations: From the second pair:
2t - 2s = -4-8t -1 - 2t = -6 + 8s
10t - 2s = -4 5 = 2t + 8s
5t - s = -2
So we have
5t - s = -2 -> 40t - 8s = -16
2t + 8s = 5 2t + 8s = 5
----------------
42t = -11
t = -11/42
and
s = 2 + 5t
= 2 - 55/42
= 29/42
So the vector joining the two points of closest approach is:
i(t-s) + j(-1-2t) + k(-3+4s)
i(-20/21) + j(-10/21) + k(-5/21) (which checks with its direction
ratios)
and the magnitude of this vector is
sqrt[525/441]
= sqrt[25/21]
= 5/sqrt(21) (which checks)
The equation of this line will be found using the value of t just
found to give a point on the line [(1,1,-6) - (11/42)(1,-2,0)] and the
direction ratios (4,2,1).
The point on the line is [31/42,32/21,-6] and the parametric equation
of the line is:
r = [31/42,32/21,-6] + p[4,2,1]
Example (2)
Find the shortest distance between the given lines, and the points of
closest approach on each line.
x y-3 z x-5 y-8 z-2
--- = --- = --- = s and --- = --- = --- = t
1 1 -1 3 7 -1
The common perpendicular is obtained from the vector product
| i j k |
| 1 1 -1 | = i(6) -j(2) + k(4)
| 3 7 -1 |
So common perpendicular is the vector (3,-1,2) which can be written as
a unit vector in the form 1/(sqrt(14)[3,-1,2]
The vector connecting the given point on line (1) with the given point
on line (2) is [(5-0),(8-3),(2-0)] = (5,5,2)
scalar product of this with the common perpendicular in unit vector
form is
5 x 3 + 5 x (-1) + 2 x 2 14
------------------------ = -------- = sqrt(14)
sqrt(14) sqrt(14)
So shortest distance is sqrt(14).
Now to find the points of closest approach, we have:
line (1) is r = (0,3,0) + s(1,1,-1) = [s,(3+s),-s]
line (2) is r = (5,8,2) + t(3,7,-1) = [(5+3t),(8+7t),(2-t)]
and we must find s and t.
The line joining a general point on line (1) to a general point on
line (2) is the vector
[(5+3t-s),(8+7t-3-s),(2-t+s)]
[(5+3t-s),(5+7t-s),(2-t+s)]
and if s and t are the points of closest approach this must be
parallel to the vector (3,-1,2). So
5+3t-s 5+7t-s 2-t+s
------ = ------ = -----
3 -1 2
From these equations s = -1 and t = -1.
The points of closest approach are therefore
on line(1): (-1,2,1) and on line(2): (2,1,3)
Check that shortest distance is sqrt(14)
shortest distance = sqrt((2+1)^2 + (1-2)^2 + (3-1)^2)
= sqrt(9 + 1 + 4) = sqrt(14)
- Doctor Anthony, The Math Forum
http://mathforum.org/dr.math/
|
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]


Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/