# Find the point where the two lines intersect.

I have two lines that intersect each other at a specific point. The equation of these lines is :

$$g_1: x = b_1 + sr_1= \begin{bmatrix}1\\6\\1\end{bmatrix} + s\begin{bmatrix}2\\0\\1\end{bmatrix}, s \in \mathbb{R}$$

$$g_2: x = b_2 + tr_1= \begin{bmatrix}6\\8\\9\end{bmatrix} + t\begin{bmatrix}9\\6\\9\end{bmatrix}, t \in \mathbb{R}$$

To solve for $$(s,t)^T$$, the point where $$g_1$$ and $$g_2$$ intersect, I made $$g_1=g_2$$, which is:

$$\begin{bmatrix}1\\6\\1\end{bmatrix} + s\begin{bmatrix}2\\0\\1\end{bmatrix}=\begin{bmatrix}6\\8\\9\end{bmatrix} + t\begin{bmatrix}9\\6\\9\end{bmatrix}$$ from which I got three equations:

$$1. 9t-2s = -5$$

$$2. 6+0s=8+6t$$

$$3. 9t-s=-8$$

From the second equation I got that $$t = \frac{-1}{3}$$ which I then substituted back into equation $$1$$ to get that $$s=1$$. However when I put $$t$$ into the 3rd equation, I get $$s=-5$$. I did this several times and got the same answer, which doesn't make sense unless I either don't understand the concept or my calculations are wrong.

• Now that we’ve established that the lines don’t intersect, I have to ask: did you copy the exercise correctly?
– amd
Dec 1, 2019 at 0:28

The lines do not intersect. If they did, they would be coplanar, in which case $$\begin{vmatrix}1&6&1&1\\2&0&1&0\\6&8&9&1\\9&6&9&0\end{vmatrix}$$ would vanish, but its value is actually $$48$$. The rows of the above matrix are the homogeneous coordinates of the points and direction vectors that define the two lines.

• Is this approach equivalent to mine? Why your matrix is 4 by 4? Sorry for the questions but I’m not used with this approach.
– user
Dec 1, 2019 at 0:09
• @user It is, although you have an arithmetic error in your answer ($9-1\ne7$). Observe that if you subtract the first row from the third in my matrix and develop along the last column, it reduces to your determinant (up to sign). The matrix is $4\times4$ because, as I wrote in the answer, I worked in homogeneous coordinates.
– amd
Dec 1, 2019 at 0:14
• Thanks a lot I fix. What is the advantage to operate in homogeneous coordinates?
– user
Dec 1, 2019 at 0:16
• @user Many advantages. Among them are that direction vectors and points are treated uniformly, affine transformations (actually, any projective transformation) can be represented by matrix multiplication, and large class of problems reduces to computing null vectors of matrices. The methods generalize to any finite-dimensional space, whereas anything that involves cross products—typical in the solution of “find the plane” and “find the line” problems—is limited to $\mathbb R^3$. A disadvantage is that, for example, lines in $\mathbb R^3$ don’t have a convenient representation.
– amd
Dec 1, 2019 at 0:20
• I need to try to use that! I’ll take a look to this way! Thanks
– user
Dec 1, 2019 at 0:23

These lines do not intersect. As you pointed out, there is no solution for the system of equations. Your method is correct.

• How did you find that out? Since the dot product of the two direction vectors is not equal to zero, which means they can't be parallel. Furthermore, since $a_1 \cdot a_2 (r_1 - r_2) \neq 0$, where $a_2$ and $a_1$ are the direction vectors and $r_2$ and $r_1$ are the vectors without the variable, it means that these two lines intersect. Nov 30, 2019 at 20:35
• @SkiMask The dot product’s not being zero means that the lines can’t be orthogonal. For parallelism, you just need to see if the direction vectors are scalar multiples of each other.
– amd
Nov 30, 2019 at 23:52

A way to check whether or not a solution exists is to consider:

• $$v_1=r_1=(2,0,1)$$ parallel to $$g_1$$
• $$v_2=r_2=(9,6,9)$$ parallel to $$g_2$$
• $$v_3=b_2-b_1=(5,2,8)$$ from $$g_1$$ to $$g_2$$

and evaluate

$$\begin{vmatrix}2&0&1\\9&6&9\\5&2&8\end{vmatrix} \neq 0$$

which should be equal to zero if the two lines were intesecting.