# How to find Projection matrix onto the subspace

I need help finding the projection of a matrix onto the subspace $W \subset \mathbb{R}^3$ given by the equation $x+y+z=0$

I am not sure what to start with to answer this question. Do I use projection formula?

Many thanks in advance.

HINT

1) Method 1

• consider two linearly independent vectors $v_1$ and $v_2$ $\in$ plane
• consider the matrix $A=[v_1\quad v_2]$
• the projection matrix is $P=A(A^TA)^{-1}A^T$

2) Method 2 - more instructive

Ways to find the orthogonal projection matrix

Write the defining equation of $W$ in matrix form $$\begin{bmatrix}1&1&1\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix} = 0,$$ from which you should see that $W$ is the null space of the matrix on the left, that is, the orthogonal complement of the span of $(1,1,1)^T$. The orthogonal projection of a vector $v$ onto $W$ is then whatever’s left over after subtracting its projection onto $(1,1,1)^T$—i.e., the orthogonal rejection of $v$ from $(1,1,1)^T$. Therefore, the matrix of orthogonal projection onto $W$ is $I_3-P$, where $P$ is the matrix for projection onto $(1,1,1)^T$, which I’m assuming that you can compute using the projection formula that you mentioned.