Prove with MATLAB whether a set of n points is coplanar I need to find a way to prove if a set of n points are coplanar. I found this elegant way on one of the MATLAB forums but I don't understand the proof. Can someone help me understand the proof please?
" The most insightful method of solving your problem is to find the mean square orthogonal distance from the set of points to the best-fitting plane in the least squares sense. If that distance is zero, then the points are necessarily coplanar, and otherwise not.
Let x, y , and z be n x 1 column vectors of the three coordinates of the point set. Subtract from each, their respective mean values to get V, and form from it the positive definite matrix A,
V = [x-mean(x),y-mean(y),z-mean(z)];
A = (1/n)*V'*V;
Then from
[U,D] = eig(A);
select the smallest eigenvalue in the diagonal matrix D. This is the mean square orthogonal distance of the points from the best fitting plane and the corresponding eigenvector of U gives the coefficients in the equation of that plane, along with the fact that it must contain the mean point (mean(x),mean(y),mean(z))."
Here is the link from where I obtained this information.
http://www.mathworks.com/matlabcentral/newsreader/view_thread/25094

If you put all the points as columns in a matrix, the resulting matrix will have rank equal to 2 if the points are coplanar.  If such a matrix is denoted as $\mathbf A$ then $\mathbf{AA}^T$ will have one eigenvalue equal to or close to 0.
Consider that V*U = 0 yields the equation of the plane.  Then consider that V'*V*U = V'*0 = 0 can be interpreted as A*U = 0*U which by definition makes U the eigenvector associated with the eigenvalue 0 of A.
