# janmr blog

## Line-line Intersection in the Plane30 March 2010

How do you calculate the point where two lines in the plane intersect? It is not very hard to do, but the formula can look quite complicated, depending on how you write it up. This article is a reminder that it can be expressed in a simple manner.

We start out by not restricting ourselves to the plane, but any vector space with an inner product . Let two lines be represented as

(1)

and

where , , , and are vectors. We assume that both and are non-null. See Figure 1.

We look for values of and such that

(2)

Let be a vector perpendicular to , . We get

(3)

Now if there are two possibilities: If there are infinitely many solutions, i.e., the lines overlap, but if there are no solutions, i.e., the lines are parallel and do not intersect.

Assume then . We get

and thus, after inserting into (1), the point of intersection is

### The Plane is Special

The derivation above is actually a little careless. If (2) is to hold for some and , then (3) must also hold. Turning the implication the other way, which we would like to, is less straightforward.

Assume that (3) holds for some value of ,

(4)

What does this mean? It means that the vectors and are perpendicular to each other, and if we are in two dimensions/the plane we must have for some value of . This is (2) and we are done.

Does this work in higher dimensions? Generally, no. Consider, e.g., three dimensions and Equation (4). What can we derive of it now? We have that

for some values of and and where . And does not necessarily hold for any , so (2) does generally not follow in three dimensions or more.

### Summary Using Coordinates

Let us consider the usual two-dimensional Euclidean space and Cartesian coordinates. We set

and use the inner product

Rotating a vector counterclockwise by a right angle is easily done with . It is easily checked that .

Recall that we are interested in knowing whether the two lines

and

intersect.

Setting and , we have

• , : The two lines overlap.
• , : The lines are parallel but do not intersect.
• : The lines meet at a single point, .