# How to calculate the intersection of two planes?

How to calculate the intersection of two planes ?

These are the planes and the result is gonna be a line in $\Bbb R^3$:

$x + 2y + z - 1 = 0$

$2x + 3y - 2z + 2 = 0$

• What representation of the result do you seek? What have you done so far? – AlexR Aug 25 '13 at 17:29
• To calculate an intersection, by definition you must set the equations equal to each other such that the solution will provide the intersection. In short, set $$x + 2y + z - 1 = 2x + 3y - 2z + 2 = 0$$ To get a matrix you must solve. – Don Larynx Aug 25 '13 at 17:35
• I found another solution. Simply you find a point, where the line of intersection intersects with one of the planes $xy,yz,xz$ (it must with at least one of them). That you can do by setting one of the variables to 0 and solving it. Then you find vector parallel to the line. It must be orthogonal to both of the normal vectors, so cross product of them is going to be the vector we search for. Then you have the equation of a line. – Adam Cz. Sep 24 '16 at 16:21

You need to solve the two equations $$x + 2y + z - 1 = 0 \\ 2x + 3y - 2z + 2 = 0.$$

Notice that, these are two equations in three variables, so you have a free variable say $z=t$, then we have

$$x + 2y = 1-t \\ 2x + 3y = 2t-2.$$

Solving the last system gives

$$\left\{ x=-7+7\,t,y=4-4\,t \right\} .$$

Then the parametrized equation of the line is given by

$$(x,y,z)= (-7+7t, 4-4t,t)=(-7,4,0)+(7,-4,1)t .$$

While this problem has a great textbook answer, as walcher explained, I don't think it's very elegant. This is because, the solution is depends on picking an arbitrary point, which lacks geometric intuition. Ideally, we'd like this point to have some meaning, such as being close to the planes, or the line or etc.

For that, I'd like to remind you of a solution by John Krumm, remains to be unnoticed by many. Let $\mathbf{p}=\{p_x,p_y,p_z\}$ and $\mathbf{n}=\{n_x,n_y,n_z\}$ compose the plane $\mathbf{P}=\{\mathbf{n},\mathbf{p}\}$. Let there be two planes $P_1$ and $P_2$, for which we'd like to compute the intersecting line $\mathbf{l}$. It's trivial to compute the direction as the cross-product: $$\mathbf{l}_d=\mathbf{n}_1 \times \mathbf{n}_2$$

If we additionally desire that the resulting point $\mathbf{p}$ is as close to the chosen point $\mathbf{p}_0$ as possible, we could write a distance : $$\lVert \mathbf{p}-\mathbf{p}_0 \rVert = (p_x-p_{0x})^2 + (p_y-p_{0y})^2 + (p_z-p_{0z})^2$$ Incorporating the other points in the similar fashion, and writing this constraint using Lagrange multipliers into an objective function results in: $$J=\lVert \mathbf{p}-\mathbf{p}_0 \rVert+\lambda(\mathbf{p}-\mathbf{p}_1)^2 + \mu(\mathbf{p}-\mathbf{p}_2)^2$$

Using the standard Lagrange framework (omitting the details), one establishes a nice matrix, in the form: $$\mathbf{M}= \left[ {\begin{array}{ccc} 2 & 0 & 0 & n_{1x} & n_{2x}\\ 0 & 2 & 0 & n_{1y} & n_{2y}\\ 0 & 0 & 2 & n_{1z} & n_{2z} \\ n_{1x} & n_{1y} & n_{1z} & 0 & 0\\n_{2x} & n_{2y} & n_{2z} & 0 & 0 \end{array} } \right]$$ This matrix can now be used in a system of linear equations: $$\mathbf{M}\left[ {\begin{array}{c} p_x \\ p_y \\ p_z \\ \lambda \\ \mu \end{array} } \right] = \left[ {\begin{array}{c} 2p_{0x} \\ 2p_{0y} \\ 2p_{0z} \\ \mathbf{p}_1 \cdot \mathbf{n}_1 \\ \mathbf{p}_2 \cdot \mathbf{n}_2 \end{array} } \right]$$ to solve for the unknown point, $\mathbf{p}$, as well as the Lagrange multipliers, $\{\lambda, \mu\}$. While the multipliers are not of particular interest they would be interesting for understanding configuration of points, or for different parameterizations.

I think this is a pretty neat approach giving a nice and simple method, with a geometrically interpretable results. I post the MATLAB code at my blog: http://tbirdal.blogspot.de/

The first plane has normal vector $$\begin{pmatrix}1\\2\\1\end{pmatrix}$$ and the second has normal vector $$\begin{pmatrix}2\\3\\-2\end{pmatrix}$$, so the line of intersection must be orthogonal to both of these. We know that the unique vector orthogonal to two linearly independent vectors $$v_1,v_2$$ is $$v_1\times v_2$$, so the direction vector of the line of intersection is $$\begin{pmatrix}1\\2\\1\end{pmatrix}\times \begin{pmatrix}2\\3\\-2\end{pmatrix}=\begin{pmatrix}-7\\4\\-1\end{pmatrix}$$Next, we need to find a particular point on the line. We can try $$y=0$$ and solve the resulting system of linear equations:\begin{align}x+z-1&=&0\\2x-2z+2&=&0\end{align} giving $$x=0, z=1$$, thus the line of intersection is $$\lbrace{\begin{pmatrix}-7t\\4t\\1-t\end{pmatrix}:t\in \Bbb R\rbrace}$$

• Can you please elaborate as to what you did to find any random point on the line?I didn't quite understand – Karan Singh Apr 26 '16 at 9:01
• In your set of linear equations, where did that last '-1' (in equation 1) come from?. And where did that last '+2' (in equation 2) come from?. – loldrup May 21 '16 at 20:45
• How did you parameterize? How did you find the normal vectors? What is the upward caret operator? – rocksNwaves May 1 '18 at 14:02