It should be simple, but I'm having trouble.
The three points are $$A(1,-2,1)\qquad B(4,-2,-2)\qquad C(4,1,4)$$ The plane I get is $$x+2y+z+6=0$$ but it obviously does not pass through the three points $A,B,C$.
It should be simple, but I'm having trouble.
The three points are $$A(1,-2,1)\qquad B(4,-2,-2)\qquad C(4,1,4)$$ The plane I get is $$x+2y+z+6=0$$ but it obviously does not pass through the three points $A,B,C$.
Here's one way to get the requisite plane:
The final equation of the plane is $x-2y+z-6=0$.
You’re looking for an equation of the form $ax+by+cz+d=0$. Plugging the coordinates of the known points into this generic equation gives you the following system of linear equations: $$\begin{align} a-2b+c+d&=0 \\ 4a-2b-2c+d&=0 \\ 4a+b+4c+d&=0.\end{align}$$ Solve this system for the unknown coefficients $a$, $b$, $c$ and $d$. The solution won’t be unique, but if all goes well (you haven’t made a mistake and the points aren’t colinear) the solution space will be one-dimensional. That’s to be expected since you can multiply the equation of a plane by any nonzero constant to get another equation for the same plane.
The above system can be written as the matrix equation $$\begin{bmatrix}1&-2&1&1\\4&-2&-2&1\\4&1&4&1\end{bmatrix} \begin{bmatrix}a\\b\\c\\d\end{bmatrix} = 0$$ from which it’s evident that the coefficients of the equation of the plane are the components of any nonzero element of the null space of the matrix on the left. The first three columns are just the $x$-, $y$- and $z$-coordinates of the three points, therefore one can find the equation of the plane through three noncolinear points by computing the null space of $$\begin{bmatrix}x_1&y_1&z_1&1\\x_2&y_2&z_2&1\\x_3&y_3&z_3&1\end{bmatrix}.$$ In fact, it’s possible to do better and write down an equation of the plane directly. Every other point $(x,y,z)$ on the plane also generates a linear equation in the coefficients of the plane equation. In order to add it to the above system without reducing the dimension of the solution set, it must be dependent on the other equations, i.e., it must be a linear combination of the other three. This means that for any point $(x,y,z)$ on the plane, the rows of $$A = \begin{bmatrix}x&y&z&1\\x_1&y_1&z_1&1\\x_2&y_2&z_2&1\\x_3&y_3&z_3&1\end{bmatrix}$$ must be linearly dependent, but that means that $\det A=0$ is an equation of the plane. Applying this idea to the three points in your problem produces the equation $9x-18y+9z-54=0$, which becomes $x-2y+z-6=0$ after eliminating the common factor of $9$. This method is applicable to a wide variety of curves and surfaces.
I wish to expand @amd s answer more verbosly since it omits some logic. Also my answer can be more geometry-centric which is more intuitive.
First consider the equation we use to describe a plane:
$$ ax + by + cz + d = 0 $$
Why is it this way? let's first imagine a way to describe the point set of a plane: a plane must have a normal vector, and an “offset” to determine its exact position. What about the points on it? All the points are the same distance away from origin point $(0,0)$.
It turned out that $ N = (a, b, c) $ is the normal while $d$ is a scalar used to describe the distance from the plane to origin point. Then we have (assume Normal is normalized): $$[a, b, c]\cdot[x,y,z] = d \implies Normal \cdot Point = distance$$ which means if you translate the plane in the direction of $Normal$ vector by $distance$, the plane will incident with origin point.
Now we have the coordinations of 3 points, we want a equation for all the points on that coplanar plane, which means for all $p = (x,y,z), Normal \cdot p = distance$.
Now let's look at the matrix $$M = \begin{bmatrix}x&y&z&1\\x_1&y_1&z_1&1\\x_2&y_2&z_2&1\\x_3&y_3&z_3&1\end{bmatrix}$$
This is, in fact, not a direct result, and the conclusion that $det(A) = 0$ is also not trivial. We can split the question into steps:
The answers can be:
To do translations, everything must be written in homogeneous coordinate. The matrix to translate a plane is: $$T = \begin{bmatrix}1&0&0&a*d\\0&1&0&b*d\\0&0&1&c*d\\0&0&0&1\end{bmatrix}$$ and $det(T) = 1$ since it's triangular. When $d=0$, no translation is needed, in this case it just falls back to the identity matrix $I$.
Lets write the points in columns for later translations:
$$P = \begin{bmatrix}x&x_1&x_2&x_3\\y&y_1&y_2&y_3\\z&z_1&z_2&z_3\\1&1&1&1\end{bmatrix}$$
They are written in homogeneous coordinate also, with $w = 1$, because they are points.
We have $TP=P'$ where $det(P')=0$
$P'$ looks like this which is not good for us: $$P' = \begin{bmatrix}x+a&x_1+a&x_2+a&x_3+a\\y+b&y_1+b&y_2+b&y_3+b\\z+c&z_1+c&z_2+c&z_3+c\\1&1&1&1\end{bmatrix}$$
But we have $det(AB) = det(A)det(B)$, and $det(T) = 1$ which is non-zero, so we have $$det(P)= \begin{vmatrix}x&x_1&x_2&x_3\\y&y_1&y_2&y_3\\z&z_1&z_2&z_3\\1&1&1&1\end{vmatrix}=0$$.
Note $P = M^{T}$ and we have $det(M)=det(M^{T})$, thats why we can jump into thinking $det(M) = 0$.