Given two different lines in 3D we want to find the equation
of the plane that contains them when there exists such a plane.
Notice that if the lines intersect then there is always a plane
that contains both lines. But if the lines do not intersect then
either they are parallel, and we can find the plane that contains
both, or they are skew and there is NO such plane. Let us solve the problem in general. Suppose that the two lines are given in parametric from. Line1 with position vector "a" and velocity vector "u" and Line2 with position vector "b" and velocity "v". |

> a:=vector(3): b:=vector(3): u:= vector(3): v:=vector(3):

Notice the use of the delimiter ":" instead of ";". We use it when
we don't want to look at the output. Let's now check if the two
lines intersect. They intersect when they have a point in common.
i.e. when there are parameters "s" and "t" with (a+s*u) - (b+t*v) = 0. |

> eq1 := evalm((a+s*u) - (b+t*v));

eq1 := [ a[1] + s u[1] - b[1] - t v[1], a[2] + s u[2] - b[2] - t v[2], a[3] + s u[3] - b[3] - t v[3] ]

> sol1 := solve({eq1[1],eq1[2]},{s,t});

- u[1] a[2] + u[1] b[2] + u[2] a[1] - u[2] b[1] sol1 := {t = - -----------------------------------------------, u[1] v[2] - u[2] v[1] a[1] v[2] - b[1] v[2] - v[1] a[2] + v[1] b[2] s = - ---------------------------------------------} u[1] v[2] - u[2] v[1] - u[1] a[2] + u[1] b[2] + u[2] a[1] - u[2] b[1] - ----------------------------------------------- u[1] v[2] - u[2] v[1]

Let's grab the rhs of t and s into tt and ss resp. |

> tt := op(2,sol1[1]);

- u[1] a[2] + u[1] b[2] + u[2] a[1] - u[2] b[1] tt := - ----------------------------------------------- u[1] v[2] - u[2] v[1]

> ss := op(2,sol1[2]);

a[1] v[2] - b[1] v[2] - v[1] a[2] + v[1] b[2] ss := - --------------------------------------------- u[1] v[2] - u[2] v[1]

So the two lines will intersect if tt and ss also satisfy the
third equation i.e. when |

> interlines := proc(a,u,b,v)

> local s,t,eq,sol;

> eq := evalm(a+s*u-b-t*v);

> sol := solve({eq[1],eq[2],eq[3]},{t,s});

> end:

Let's test it, |

> interlines([1,0,1],[-2,0,3],[1,0,2],[1,0,-1]);

{s = 1, t = -2}

so, yes there is intersection since: ## When the Lines IntersectIn this case the plane that contains the two intersecting lines goes through the point of intersection and its normal is orthogonal to the velocity vectors of the two lines. Thus, it has normal vector: uxv. The point of intersection can be easily computed with, |

> st := interlines([1,0,1],[-2,0,3],[1,0,2],[1,0,-1]): st[1]; st[2];

s = 1 t = -2

Link to the commands in this file

Carlos Rodriguez <carlos@math.albany.edu> Last modified: Wed Sep 3 11:55:29 EDT 1997