# How do you detect if a point is in a plane?

Let's say we have 3 points: (-2,7,4), (-4,5,2), (3,8,5) and we want to see if a fourth point, (2,6,3), is in the plane that the previous 3 points made. How would I go about doing this?

-

Let $(x_1, y_1, z_1)$, $(x_2, y_2, z_2)$, and $(x_3, y_3, z_3)$ be the three given points, and $(a,b,c)$ be the fourth. A little linear algebra shows that $(a,b,c)$ is in the plane if and only if the following matrix has rank 2 (assuming of course that the three given points are not collinear):

$$\left[\begin{array}{ccc} x_2-x_1 & y_2-y_1 & z_2-z_1 \\ x_3-x_1 & y_3-y_1 & z_3-z_1 \\ a-x_1 & b-y_1 & c-z_1 \end{array}\right]$$

Hope this helps!

-
I'm still fairly new to linear algebra. What exactly is a rank 2 matrix? (On a side note, if I know what a rank 2 is, this will be exactly what I'm looking for! :) ) – Steven Fontaine Oct 27 '12 at 1:54
Rank is the maximum number of linearly independent rows. Instead of detecting the rank explicitly for this question, it suffices to check that the determinant is 0. – Shaun Ault Oct 27 '12 at 1:56
Alright. Thanks a lot! – Steven Fontaine Oct 27 '12 at 1:57
Just FYI: Rank determination is difficult to do numerically. – copper.hat Oct 27 '12 at 2:11
I would caution against using rank determination in a numerical setting if you are using floating point calculations. The method I suggested is slightly more costly, but returns a meaningful number (distance to the plane) which you can compare with some $\epsilon >0$ to decide if it is 'close enough'. – copper.hat Oct 27 '12 at 2:29

Let $x_1,x_2,x_3 \in \mathbb{R}^3$ be three non-collinear points. Let $n = (x_2-x_1) \times (x_3-x_1)$, $\hat{n} = \frac{1}{\|n\|} n$, and $d = \langle x_1, \hat{n} \rangle$. Then $|\langle x, \hat{n} \rangle -d|$ is the distance from the point $x$ to the plane spanned by $x_1,x_2,x_3$. Typically, you need to decide numerically whether or not the point is actually on the plane.

In your case we can perform the calculations exactly: $n = (0, -8, 8)^T$, $\hat{n} = \frac{1}{8\sqrt{2}} (0, -8, 8)^T$, $d = -\frac{3}{\sqrt{2}}$.

If we let $x = (2,6,3)^T$, we have $\langle x, \hat{n} \rangle = -\frac{3}{\sqrt{2}}$, hence the distance to the plane = $|-\frac{3}{\sqrt{2}}+\frac{3}{\sqrt{2}}| = 0$, so the point is on the plane.

In fact, with a little more calculation, you can show that $x = \frac{1}{8} (-11 x_1 + 9 x_2 + 10 x_3)$, and since the coefficients sum to $1$, $x$ lies in what is known as the affine hull of $x_1,x_2,x_3$, which in this case is the plane containing the points.

To complete the connection, you can show that $\langle x-x_1, n \rangle = \det A$, where $A = \begin{bmatrix} x_2-x_1 & x_3-x_1 & x - x_1 \end{bmatrix}$. Note that $A$ is the transpose of the matrix in Shaun's answer. The catch here is that you need to scale by $\frac{1}{\|n\|}$ to get a numerically meaningful answer.

-

Use the given three points to find the equation of the plane, $ax+by+cz=d$. Then plug in the fourth point and see if it satisfies the equation.

-
And what exactly is d in that equation? – Steven Fontaine Oct 27 '12 at 1:50
The equation of a plane can be expressed as $ax+by+cz=d$, where $a,b,c,d$ are real numbers. Another useful version is $a(x-x_o)+b(y-y_o)+c(z-z_o)=0$, where $(x_o,y_o,z_o)$ is a point in the plane and $\langle a,b,c \rangle$ is the normal vector of the plane. – BobaFret Oct 27 '12 at 1:56