Find perpendicular distance from point to line in 3D? I have a Line going through points B and C; how do I find the perpendicular distance to A?
$$A= (4,2,1)$$
$$B= (1,0,1)$$
$$C = (1,2,0)$$

 A: You can parameterize the line (and you don't even need to worry about the fact that it’s a segment):
$$B-C=\langle 0,-2,1 \rangle$$
so the line is $$\langle 1,0,1 \rangle+ t\ \langle 0,-2,1 \rangle$$
So for some value of $t$, call it $k$, the vector from $A$ to $\langle 1,-2k,1+k \rangle$ is orthogonal to $\langle 0,-2,1 \rangle$. Thus
$$(\langle 1,-2k,1+k \rangle-\langle 4,2,1\rangle)\cdot \langle 0,-2,1\rangle=0$$
$$\langle -3,-2k-2,k \rangle\cdot \langle 0,-2,1\rangle=0$$
$$4k+4+k=0$$
$$k=-\frac{4}{5}$$
so now you should be able to find the point.
A: Hint: A point on the line BC is described by $t B + (1-t)C$, $t\in {\Bbb R}$. Try to minimize its distance to $A$
A: Another approach (a very low-tech solution). By the Pythagorean theorem we have 
$$ AB=\sqrt{13},\qquad AC=\sqrt{10},\qquad BC=\sqrt{5}\tag{1}$$
hence $ABC$ is an acute triangle (since $AB^2<AC^2+BC^2$ and so on) and by calling $H_A$ the projection of $A$ on $BC$, we also have
$$ H_A B^2 - H_A C^2 = AB^2 - AC^2 = 3 \tag{2}$$
Since $H_A B + H_A C = BC = \sqrt{5}$, from $(2)$ it follows that $H_A B-H_A C = \frac{3}{\sqrt{5}}$, so:
$$ H_A B = \frac{4\sqrt{5}}{5}\qquad H_A C = \frac{\sqrt{5}}{5}\tag{3}$$
and:
$$\boxed{\phantom{\sum_{j=1}^{n^2}} H_A = \frac{4}{5}C+\frac{1}{5}B = \color{red}{\left(\frac{5}{5};\frac{8}{5};\frac{1}{5}\right)},\qquad AH_A^2 = AC^2-H_A C^2 = \color{red}{\frac{49}{5}}\phantom{\sum_{j=1}^{n^2}}}\tag{4} $$
A: Arbitrary point on the line: $(1, 2t , -t)$ for $t \in \mathbb R$. The line is parallel to the vector $\vec{BC} = <0,2,-1>$.
If $D(1, 2t_0,-t_0)$ is the point on the line closest to $A$, we must have $\vec{AD} \bullet \vec{BC} =0$ (because $\vec{AD}$ must be perpendicular to the line)
A: By translation, we may assume one of the points (say $C$) is the origin (which is to say, consider $A-C$ and $B-C$ instead).  Then, the question is what is the distance between a vector $A$ and the orthogonal projection of $A$ onto the subspace spanned by the vector $B$.  Let $s=(a_1b_1+a_2b_2+a_3b_3)/(b_1^2+b_2^2+b_3^2)$.  Then, the distance is this formula: $\sqrt{(a_1-sb_1)^2+(a_2-sb_2)^2+(a_3-sb_3)^2}$. This is $\lVert A-\frac{A\cdot B}{B\cdot B}B\rVert$.
A: Intuitively, you want the distance between the point A and the point on the line BC that is closest to A. And the point on the line that you are looking for is exactly the projection of A on the line. The projection can be computed using the dot product (which is sometimes referred to as "projection product").
So you can compute the direction vector $\mathbb{d}$ of the line $BC$. This is the difference of $B$ and $C$, divided by their distance:
$$\mathbb{d} = (C-B) / ||C-B||$$
Then you can define a vector from $B$ to $A$:
$$\mathbb{v} = A - B$$
Computing the dot product between this vector and the direction vector will give you the the distance between $B$ and the projection of $A$ on $BC$:
$$ t = \mathbb{v} \cdot \mathbb{d}$$
The actual projection $P$ of $A$ on $BC$ is then given as
$$P = B + t \cdot \mathbb{d}$$
And finally, the distance that you have been looking for is
$$|| P - A||$$

Of course, this could be written in a somewhat shorter form. It has the advantages of giving you exactly the closest point on the line (which may be a nice add-on to computing only the distance), and it can be implemented easily. Some pseudocode:
double computeDistance(vec3 A, vec3 B, vec3 C) {
    vec3 d = (C - B) / C.distance(B);
    vec3 v = A - B;
    double t = v.dot(d);
    vec3 P = B + t * d;
    return P.distance(A);
}

A: If you are familiar with cross-product, you can get the required distance by calculating $$\frac{|\overrightarrow{BA}\times\overrightarrow{BC}|}{|\overrightarrow{BC}|}$$
A: Playing with the solutions, I built this simulation one of them:
Using a vector equation of the line through $BC$. And Pythagoras's theorem to get the distance from $A$ to a point in the line.
Minimised by using the point where the derivative equals 0.  

A: Similar to answer by Jack we can use the concept of vector and dot product. 
From $B=(1,0,1)$ and $C = (1,2,0)$, we get the line segment $B-C = (0,-2,1)$ we consider it as a vector. Then from $A=(4,2,1)$ if the perpendicular line to this line intersects this line at $(x,y,z)$ we get another vector $(4-x,2-y,1-z)$. Now as these two vectors $(0,-2,1)$ and $(4-x,2-y,1-z)$ are perpendicular to each other, their dot product will be zero so we get first equation
$(4-x).0+(2-y).(-2)+(1-z).1 = 0$, so we get $2y-z=3$; we get the other equations in the form $\dfrac{y-0}{z-1}= \dfrac{-2}{1}$, so $y+2z=2$ and $\dfrac{x-1}{y-0}= \dfrac{0}{-2}$ 

So we get three equations $2y-z=3$ , $y+2z=2$, and $x-1=0$, 
we get $x=1,y=8/5,z=1/5$ and from this we calculate the distance. 

In this way we always get three linear equations of $x,y,z$ which we can solve by simple elimination process.
