Orthogonal projection matrix onto a plane

linear algebramatricesprojection-matricesvector-spaces

To find, for example, the orthogonal projection matrix onto the plane:
$$x-y-z = 0$$
… we would choose two independent vectors that lie on the plane, use them as columns of a matrix A, and use the following equation:

enter image description here

As I understand it, this works because this matrix essentially projects onto the column space of A, but given how we have created matrix A, the column space of the matrix is exactly equal to the plane of interest.

However, does this method still apply for planes not passing through the origin?

Because as far as I know, column space (when it is a 2D subspace of $R^3$) is a plane through the origin. So, if you take two independent vectors on a plane not passing through the origin, and come up with an orthogonal projection matrix as I have described, surely that matrix would project onto a plane that is through the origin (the column space of A), and not the intended plane (albeit the two planes would have the same basis/direction vectors)?

Am I missing something here?

Best Answer

If the plane equation is

$ n^T (r - r_0) = 0 $

Then let

$ A = [u_1, u_2] $

where $n \cdot u_1 = n \cdot u_2 = 0 $ and $u_1 $ and $u_2$ are linearly independent.

Then the projection of a point $P$ onto the plane is

$ \text{Proj}(P) = r_0 + A (A^T A)^{-1} A^T (P - r_0) $

To derive this formula, note that

$ r = r_0 + A u $

where $ u \in \mathbb{R}^2 $. Since we want $r$ to be the projection of $P$ onto the plane, then

$ P - r $ is perpendicular to the plane, i.e. perpendicular to $u_1$ and $u_2$, therefore,

$ A^T (P - r_0 - A u) = 0 $

From which

$ u = (A^T A)^{-1} A^T (P - r_0)$

Hence,

$ \text{Proj}(P) = r = r_0 + A u = r_0 + A (A^T A)^{-1} A^T ( P - r_0) $