Finding the distance between a point and line (3-D) Given $x=1+t, y=2-t, z=1+3t$, and the point $(3,2,-7)$.
Find the distance between the point and the line.
First, I rewrote the line and point as a vector and vector equation 
$\vec r(t)=\langle1+t,2-t,1+3t\rangle$ 
$\vec r_0=\langle3,2,-7\rangle$

I then computed the dot product between them, set it equal to zero, and solved for t. This gave me $t=0$. Which can be confirmed by the fact that $\langle 3,2,-7\rangle \cdot \langle1,2,1\rangle=0$.
Since $(1,2,1)$ is on the line and orthogonal to $\langle 3,2,-7\rangle$. The length should be $\sqrt 6$. However, the answer appears to actually be $2\sqrt 6$. What did I do wrong?
 A: Why do you think that it matters that $(3,2,-7)$ and $(1,2,1)$ are orthogonal? It doesn't.
The square of the distance from $(1+t,2-t,1+3t)$ to $(3,2,-7)$ is\begin{align}(-2+t)^2+(-t)^2+(8+3t)^2&=11t^2+44t+68\\&=11(t+2)^2+24.\end{align}So, the minimal distance is $\sqrt{24}=2\sqrt6$.
A: There are a few ways to deal with this problem. One, described in this answer, is to compute the distance to the line as a function of $t$ and minimize it. The square of this function is quadratic in $t$, so you don’t really need calculus to solve this.  
You might instead compute the point $\vec r(t)$ on the line at which $\vec r(t)-\vec r_0$ is perpendicular to the line. This involves solving the equation $(\vec r(t)-\vec r_0)\cdot(1,-1,3)=0$. This equation is linear in $t$, so should be quite easy to solve. This approach looks like what you were trying to do, except that you found the point at which the position vectors $\vec r(t)$ and $\vec r_0$ are orthogonal, which isn’t what you needed. It’s also possible to compute this orthogonal projection onto the line without solving any equations.  
Yet another way takes advantage of the geometry of the situation to make a direct computation. If $\vec r_1$ and $\vec r_2$ are two points on the line, then the perpendicular distance to the line from $\vec r_0$ is the length of the altitude from $\vec r_0$ of the triangle formed by these three points. That in turn is twice the area of the triangle, which can be computed via a cross product, divided by the distance between $\vec r_1$ and $\vec r_2$. That is, the distance from $\vec r_0$ to the line is $${\|(\vec r_1-\vec r_0)\times(\vec r_2-\vec r_0)\| \over \|\vec r_1-\vec r_2\|}.$$ Taking $\vec r(0)$ and $\vec r(1)$ as the two points on the line, this becomes $${\|\left((1,2,1)-(3,2,-7)\right)\times\left((2,1,4)-(3,2,-7)\right)\| \over \|(1,2,1)-(2,1,4)\|} = {2\sqrt{66}\over\sqrt{11}} = 2\sqrt6.$$
