# 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$

• 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. Aug 25, 2013 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. Sep 24, 2016 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 .$$

• Can you explain how you got the parameterized result? Sep 23, 2021 at 4:46

From the coefficients of x, y and z of the general form equations, 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. Here, since a line that isn't parallel to any coordinate plane passes through all three, you can check if it is parallel to one by using the directional vector. Since here, the line passes through all three planes, we can try $$y=0$$(since it passes through the $$x-z$$ plane) 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 Apr 26, 2016 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?. May 21, 2016 at 20:45
• How did you parameterize? How did you find the normal vectors? What is the upward caret operator? May 1, 2018 at 14:02
• @loldrup It comes from the initial plane equation, by replacing y by 0 (the author decided to set y = 0 to solve the system) Oct 1, 2021 at 9:52
• @rocksNwaves The normal vector comes from the plane equation coefficient in front of x, y and z. Parameterization comes from the line equation \$t * \vec{u} + T\$ with T being the point \$x=0, y=0, z=1 \$ Oct 5, 2021 at 16:36

While this problem has a great textbook answer, as @walcher explained, I don't think it's very elegant. This is because, the solution 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, which remains 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 to solve for the unknown point, $$\mathbf{p}$$, as well as the Lagrange multipliers, $$\{\lambda, \mu\}$$.: $$\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]$$ 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.

In this question, we can find any point that will lie on the line intersecting the two planes, suppose $$(a,b,0)$$. Then we can simultaneously solve the the two planes equation by putting this point in it.
$$a+2b=1\qquad2a+3b=-3$$ After solving these two, we will get $$a=-7$$ and $$b=4$$. Now, we can find the direction of the line we need to find by taking cross product of normal vectors of two given planes. $$(i,2j,k) × ( 2i,3j,-2k) = (-7i,4j,-k)$$ Thus equation of line is $$-7(x+7)+4(y-4)-1(z-0)=0$$. Hence $$7x-4y+z+65=0$$

I tried the systems of equations approach posted by multiple people, but dealing with division by zero made things really messy. So I came up with a more intuitive approach.

Start with the cross product of the normal vectors of the 2 planes (Normal1 and Normal2) to get a direction of the intersection line (Normal3):

Normal3 = Normal1 × Normal2


Now if we look at the existing planes from the perspective of that direction, our 2 planes look like 2 lines, because we're viewing them both edge-on. So we want to calculate what those 2 lines are. We can get the direction of each line as the cross product of our new plane's normal with the original normal:

line1dir = Normal1 × Normal3
line2dir = Normal2 × Normal3


So now we need the origin of each of these lines. That's just the normal times the offset:

line1start = Normal1 * Offset1
line2start = Normal2 * Offset2


That gives use two lines:

line1 = (line1start, line1start + line1dir)
line2 = (line2start, line2start + line2dir)


Now if we find the intersection of those two lines, it will give a point which occurs on both lines, which means it also occurs on both planes:

https://math.stackexchange.com/questions/270767/find-intersection-of-two-3d-lines/271366


Once you have the intersection point, combine it with the Normal3 we calculated at the beginning to get the intersection line.

• What is offset? Dec 3, 2021 at 13:30
• Each plane is defined by a Normal (direction perpendicular to the plane) and an Offset (closest distance of the plane to the origin). Dec 6, 2021 at 17:44
• Does offset have to be the closest point to the origin or can it be any point on the plane? Dec 7, 2021 at 4:28
• Offset is a scalar, not a vector. It's the distance of the plane from the origin. So a plane that intersects the origin has an offset of 0. A plane 5 units above the XY plane would have a normal of 0,0,1 and a offset of 5. Offset isn't really necessary, it could be part of the normal, except for the fact that if the offset is 0, your normal would have to be 0,0,0 and then you don't know the orientation of the plane. Dec 7, 2021 at 18:38

Let $$x$$ be in the intersection of the planes $$\begin{equation*} \langle m, x-b \rangle = 0,\\ \langle n, x-c \rangle = 0 \end{equation*}$$ and let $$p = m \times n$$.

Then for some $$\lambda$$, $$\begin{equation*} \begin{pmatrix} m_0 & m_1 & m_2 \\ n_0 & n_2 & n_3 \\ p_0 & p_1 & p_2 \\ \end{pmatrix} \begin{pmatrix} x_0 \\ x_1 \\ x_2 \end{pmatrix} = \begin{pmatrix} \langle m, b \rangle \\ \langle n, c \rangle \\ \lambda \end{pmatrix}. \end{equation*}$$

Using the vector identities $$\begin{equation*} \begin{split} u \times (v \times w) &= \langle u, w \rangle v - \langle u, v \rangle w, \\ \Vert u \times v \Vert^2 &= \Vert u \Vert^2 \Vert v \Vert^2 - \langle u, v \rangle^2, \end{split} \end{equation*}$$ check that $$\begin{equation*} \begin{pmatrix} m_0 & m_1 & m_2 \\ n_0 & n_1 & n_2 \\ p_0 & p_1 & p_2 \\ \end{pmatrix} \begin{pmatrix} q_0 & r_0 & p_0 \\ q_1 & r_1 & p_1 \\ q_2 & r_2 & p_2 \\ \end{pmatrix} = \Vert p \Vert^2 I, \end{equation*}$$ where $$\begin{equation*} \begin{split} q &= -n \times (n \times m), \\ r &= -m \times (m \times n). \end{split} \end{equation*}$$

If $$p \ne 0$$ (that is, if $$m$$ and $$n$$ are linearly independent), it follows that $$\begin{equation*} \begin{pmatrix} x_0 \\ x_1 \\ x_2 \end{pmatrix} = \frac{1}{\Vert p \Vert^2} \begin{pmatrix} q_0 & r_0 & p_0 \\ q_1 & r_1 & p_1 \\ q_2 & r_2 & p_2 \\ \end{pmatrix} \begin{pmatrix} \langle m, b \rangle \\ \langle n, c \rangle \\ \lambda \end{pmatrix}, \end{equation*}$$ or $$\begin{equation*} x = a + \lambda \frac{p}{\Vert p \Vert^2} \end{equation*}$$ where $$\begin{equation*} a = (\langle m, b \rangle q + \langle n, c \rangle r) / {\Vert p \Vert^2}. \end{equation*}$$

You have to solve the following system of equations: $$x + 2y + z - 1 = 0 \\ 2x + 3y - 2z + 2 = 0.$$

Since these are two equations in three variables, so you don't have solution such as $$(a,b,c)$$ but you will have a parametric relation between variables. Let $$x=t$$, then we have

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

Solving this system gives

$$x=t,y=-\frac{4}{7}t,z= 1-\frac{1}{7}t$$

which is the parametrized equation of the required line.