[Math] Finding the intersection point between two lines using a matrix

linear algebra

I'm trying to find the intersection point (if any) of two lines. Long story short, here are the parametric equations:

For the first line:

$$x = 3 + 4\lambda_1\\
y = 4 + \lambda_1\\
z = 1$$

For the second line:

$$x = -1 + 12\lambda_2\\
y = 7 + 6\lambda_2\\
z = 5 + 3\lambda_2$$

If you try to solve the equations

$$3 + 4\lambda_1 = -1 + 12\lambda_2\\
4 + \lambda_1 = 7 + 6\lambda_2\\
1 = 5 + 3\lambda_2$$

You can easily see that a solution is

$$\lambda_1 = -5\\
\lambda_2 = -\frac{4}{3}$$

But I wanted to solve the equation with a matrix instead (I like to complicate things):

$$\begin{bmatrix}
4 && -12 && -4\\
1 && -6 && 3\\
0 && 3 && 4
\end{bmatrix}$$

$$\frac{1}{4}r_1$$

$$\begin{bmatrix}
1 && -3 && -1\\
1 && -6 && 3\\
0 && 3 && 4
\end{bmatrix}$$

$$r_1-r_2$$

$$\begin{bmatrix}
1 && -3 && -1\\
0 && -3 && 4\\
0 && 3 && 4
\end{bmatrix}$$

$$r_3+r_2$$

$$\begin{bmatrix}
1 && -3 && -1\\
0 && 0 && 8\\
0 && 3 && 4
\end{bmatrix}$$

… And we got something odd! The second row says that $0\lambda_1 + 0\lambda_2 = 8$, but that can't be true. So, doesn't this mean that there is no solution because the system has an inconsistency? What did I do wrong?

Best Answer

There is an error in your initial matrix: the second row should be [0 3 -4] instead of [0 3 4] because the equation is $3\lambda_2=-4$.

I row reduced the matrix with that last row and got the same values: $\lambda_1=-5$ and $\lambda_2=\frac{-4}{3}$

Also note that you only really need two rows because you have two unknowns.

Row reduction:

$$ \begin{bmatrix} 1 & -6 & 3 \\ 0 & 3 & -4 \end{bmatrix}\to \begin{bmatrix} 1 & 0 & -5 \\ 0 & 3 & -4\end{bmatrix} \implies \lambda_1=-5, 3\lambda_2=-4$$

EDIT: using the three equations, you just get a row of zeros

$$ \begin{bmatrix} 1 & -6 & 3 \\ 4 & -12 & -4 \\ 0 & 3 & -4 \end{bmatrix}\to \begin{bmatrix} 1 & 0 & -5 \\ 0 & 12 & -16 \\ 0 & 3 & -4\end{bmatrix}\to \begin{bmatrix} 1 & 0 & -5 \\ 0 & 0 & 0 \\ 0 & 3 & -4\end{bmatrix}$$

Related Question