Perpendiculars to two vectors So this is more than likely a simple question that has been asked before, but if have 2 lines described by the formula:
$V = (x,y,z) + L (i,j,k)$
i.e.  a line described by a position and a length along a unit vector
How would I find the line that is perpendicular to both lines?
 A: First, as you know, to get a direction vector perpendicular to both direction vectors,
you can take the cross-product of the two vectors. Call the cross-product $v_\perp$.
If the lines are in the same plane and intersect at a single point, $p$,
consider the line parameterized by $p + t v_\perp$.
Is it perpendicular to both of the given lines?
Now suppose the lines are $\ell_1$, parameterized by $p_1 + Lv_1$,
and $\ell_2$, parameterized by $p_2 + Lv_2$,
and suppose those lines are not in the same plane.
Let the points $q_1$ on $\ell_1$ and $q_2$ on $\ell_2$ be the points where the
desired perpendicular line (if it exists) intersects these two lines.
Let $u$ be the vector from $p_1$ to $p_2$.
Then we can write
$$u = t_1v_1 + u_\perp + t_2v_2$$
where $t_1v_1$ is the vector from $p_1$ to $q_1$,
where $u_\perp$ is the vector from $q_1$ to $q_2$,
and $t_2v_2$ is the vector from $q_2$ to $p_2$.
Now if you just knew $u_\perp$ and either $q_1$ or $q_2$ you would have
the parameterization of a line $\ell_\perp$ perpendicular to both $\ell_1$ and $\ell_2$.
So consider the following objects along with the original $\ell_1$ and $\ell_2$:


*

*The projection of $u$ onto $v_\perp$.

*The line $\ell_2'$ parameterized by $p_2 - u_\perp + Lv_2$. (Pay special attention to the point $p_2 - u_\perp - t_2v_2$.)


You should be able to derive the necessary information from those objects.
(Hint: consider the two items in the list in the order they are listed,
and remember how the problem is solved when the original two lines intersect.)
This leaves only the case where $\ell_1$ and $\ell_2$ are parallel.
In that case the vector $u$ from $p_1$ to $p_2$ satisfies
$$u = u_\parallel + u_\perp$$
where $u_\parallel$ is parallel to both lines and $u_\perp$ is perpendicular to them.
From this it is easy enough to find a parameterization of a line
perpendicular to both $\ell_1$ and $\ell_2$,
keeping in mind that the answer is not unique.
A: Hint: Take the cross product.First write each in the form (a,b,c) by choosing t equal 0 and 1.
A: A vector perpendicular to both these lines will be perpendicular to their direction vectors, so you need to take the cross (vector) product of their direction vectors. There are going to be an infinite number of (direction) vectors perpendicular to your two lines, so if you want the equation of a perpendicular line you will need also the position vector of a point on that line.
If you don't need this last thing, then you are done with just the cross product!
A: Consider the vector from a point of the first line to a point of the second line and express that it is orthogonal to the direction of both lines.
$$(P_1+\lambda_1D_1-P_0-\lambda_0D_0)\cdot D_0=0\\(P_1+\lambda_1D_1-P_0-\lambda_0D_0)\cdot D_1=0,$$
or
$$\lambda_1D_1\cdot D_0-\lambda_0D_0^2=(P_0-P_1)\cdot D_0\\\lambda_1D_1^2-\lambda_0D_0\cdot D_1=(P_0-P_1)\cdot D_1$$
Solve the $2\times2$ linear system and you get two points on the desired line.
