# Find distance from point to line in not standart coordinate system

I have point $M(0,0,0)$ and line $$x=3t-7$$ $$y=-2t+4$$ $$z=3t+4$$ $e_1=(x_1,y_1,z_1),e_2=(x_2,y_2,z_2),e_3=(x_3,y_3,z_3)$ - our basis vectors, and $e_i*e_j=g_{ij}$ $$g_{11}=g_{22}=g_{33}=2;$$ $$g_{12}=1;g_{23}=1;g_{13}=0$$ How to find distance from given point to given line?

Well, at first we know that $|e_1|=|e_2|=|e_3|=\sqrt2$. Also we know that $e_1*e_3=0=>e1$ is perpendicular to $e_3$. And using formula $$cos\alpha=\frac{e_i*e_j}{|e_i|*|e_j|}$$ We can find angles between vectos. Finally, we have the system $$x_1x_2+y_1y_2+z_1z_2=1$$ $$x_2x_3+y_2y_3+z_2z_3=1$$ $$x_1x_3+y_1y_3+z_1z_3=0$$

I have no idea what should I do or use next. Have any thoughts?

• You’ve got the metric. Why not compute the distance to the origin of a point on the line as a function of $t$ and find its minimum? – amd Dec 10 '17 at 18:23
• @amd You mean I need write f(t) = sqrt( (3t-7)^2+(-2t+4)^2+(3t+4)^2 ). So the min will be at point t=0.773 f(t)=8.238 and it will be my answer? Are you sure I'm allowed to do it in not Cartesian coordinate system? – Николай Журба Dec 10 '17 at 18:39
• You have to use the metric defined by $g$, not the Euclidean metric. – amd Dec 10 '17 at 19:00
• @Ok, I agree. Can you write the formula? – Николай Журба Dec 10 '17 at 19:06

If you write the coordinates of a point as $(x_1,x_2,x_3)$, then the square of its distance from the origin using the given metric is $$\sum_{\lambda=0}^3\sum_{\mu=0}^3 g_{\lambda\mu} x_\lambda x_\mu = 2(x_1^2+x_1x_2+x_2^2+x_2x_3+x_3^3).†$$ Plug in the coordinates of an arbitrary point on the line to get the distance squared as a function of $t$ and minimize (and don’t forget to take the square root at the end).
You can also do this without using calculus. The line can be expressed as $(-7,4,4)^T+t(3,-2,3)^T$, so if you translate by $(7,-4,-4)^T$ so that the line passes through the origin, the problem is equivalent to finding the distance from this point to the translated line. This is a matter of computing the orthogonal rejection of $\mathbf p$ from the direction vector $\mathbf v=(3,-2,3)^T$ of the line, using the inner product induced by $g$: $$\mathbf p_\perp = \mathbf p - {\mathbf p^T G \mathbf v \over \mathbf v^T G \mathbf v}\mathbf v$$ and the distance is then $$\sqrt{\mathbf p_\perp^T G \mathbf p_\perp}.$$ Here, $G$ represents the matrix with entries given by the components $g_{\lambda\mu}$ of the metric.
† You might also see this written more simply as $g_{\lambda\mu}x^\lambda x^\mu$, where the coordinates use superscripts instead of subscripts and the Einstein summation convention is in force.
• @НиколайЖурба No, do what you did before: express the distance as a function of $t$ and minimize. – amd Dec 10 '17 at 19:22
• $\sqrt{2\left(\left(3t-7\right)^2+\left(3t-7\right)\left(-2t+4\right)+\left(-2t+4\right)^2+\left(-2t+4\right)\left(3t+4\right)+\left(3t+4\right)^3\right)}$ like this? – Николай Журба Dec 10 '17 at 19:27