# Find the closest point on one line to another line in 3D

Let P = (1, 1, -1), Q = (2, -2, -3), and R = (-1, 0, 4) be the vertices of a triangle.

Let L be a line passing through P and Q.

Find:

The point on the line x = y + 1 = z - 2 closest to the line L.

-

Hint: A parameterized version of L is $(1+t,1-3t,-1-2t)$. The other line is $(s, 1+s, s-2)$. So you can just calculate the squared distance, take the derivative with respect to s and t, and get two equations in two unknowns.
The equation of the line $L$ through $P$ and $Q$ is $\frac{x-1}{2} = -\frac{y-1}{2} = -\frac{z+1}{3}$.