Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have two points $P_1(x_1, y_1, z_1)$ and $P_2(x_2, y_2, z_2)$ on a line, $L$, and another point $P_0(x_0, y_0, z_0)$.

I want to find the distance between $P_0$ and $L$. Could someone help?

share|improve this question
6  
Hmm... –  J. M. Dec 22 '10 at 14:25
    
why at (9) there is only x? what about y and z? –  nkint Dec 22 '10 at 14:31
1  
$\mathbf{x}$ is a vector, it has all three components. –  Ross Millikan Dec 22 '10 at 14:37
    
and | x_2 - x_1 | is vector magnitude or absolute value? –  nkint Dec 22 '10 at 14:54
2  
Vector magnitude. –  Raskolnikov Dec 22 '10 at 15:14

4 Answers 4

up vote 1 down vote accepted

The distance $h$ from the point $P_0=(x_0,y_0,z_0)$ to the line passing through $P_1=(x_1,y_1,z_1)$ and $P_2=(x_2,y_2,z_2)$ is given by $h=2A/r$, where $A$ is the area of a triangle defined by the three points and $r$ is the distance from $P_1$ to $P_2$. The values of $r$ and $A$ can be computed as follows:

$r=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$ and $A=\frac{1}{2}\sqrt{a_1^2+a_2^2+a_3^2},$

where

$a_1=x_0y_1+x_1y_2+x_2y_0 - (y_0x_1+y_1x_2+y_2x_0),\\ a_2=y_0z_1+y_1z_2+y_2z_0 - (z_0y_1+z_1y_2+z_2y_0),\\ a_3=x_0z_1+x_1z_2+x_2z_0 - (z_0x_1+z_1x_2+z_2x_0).$

share|improve this answer

look here: http://paulbourke.net/geometry/pointline/ All you need to do is extend it to 3d.

share|improve this answer
    
The link is dead. –  Andrey Sokolov Jun 20 '13 at 1:41

The shortest distance from a point to a line is always perpendicular to the given line. Here, the given line is in the direction of the vector $\langle x_2-x_1, y_2-y_1, z_2-z_1\rangle$. The plane $(x_2- x_1)(x- x_0)+ (y_2- y_1)(y- y_0)+ (z_2- z_1)(z- z_0)= 0$ has that vector as normal vector and contains the point $(x_0, y_0, z_0)$ so the shortest distance is through that plane. Determine where the given line intersects that plane. The shortest distance is the distance form that point of intersection to $(x_0, y_0, z_0)$.

share|improve this answer

I thought to furnish a picture:

enter image description here

share|improve this answer
1  
Please cite your source of this image as it is clear that you did not create it. –  Daniel Rust Feb 18 at 13:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.