# Finding the projection matrix of $\mathbb R^3$ onto the plane $x-y-z=0$

Find the matrix of the projection of $\mathbb{R}^3$ onto the plane $x-y-z = 0.$

I can find a normal unit vector of the plane, which is $\vec{n}=(\frac{1}{\sqrt{3}},-\frac{1}{\sqrt{3}},-\frac{1}{\sqrt{3}})^T$

And then the vectors $\vec{u}=(1,1,0)^T, \ \vec{v} = (1,0,1)^T$ form a basis of $\mathbb{R}^3$. but why would the solution be $$A = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}?$$

• Why indeed? That $A$ is not the solution. Commented Feb 9, 2015 at 9:00
• What would you want me to answer to that, given that I already said so? Commented Feb 9, 2015 at 11:01

Assuming you mean the orthogonal projection onto the plane $W$ given by the equation $x-y-z$, it is equal to the identity minus the orthogonal projection onto $W^\perp$, which is sightly easier to compute. Now $W^\perp$ is the span of the normal vector $v=(1,-1,-1)$, and the orthogonal projection onto which is $x\mapsto \frac{(v\mid x)}{(v\mid v)}v$, and whose matrix is $$\frac13\begin{pmatrix}1\\-1\\-1\end{pmatrix} \begin{pmatrix}1&-1&-1\end{pmatrix} =\frac13\begin{pmatrix}1&-1&-1\\-1&1&1\\-1&1&1\end{pmatrix}.$$ Subtracting this from the identity gives $$\begin{pmatrix}2/3&1/3&1/3\\1/3&2/3&-1/3\\1/3&-1/3&2/3\end{pmatrix}.$$

• I see now, thank you very much! Commented Feb 9, 2015 at 16:29
• might be trivial but wasn't for me: $u = \frac{1}{\sqrt(3)}(1, -1, -1)^T$ is a unit vector. To find a projection of a vector $x$ on it we use: $uu^Tx$ as $u^Tx$ is a scalar which is the dot product of $<x,u>$ and we want it to be in the $u$ direction Commented Mar 12, 2016 at 15:04
• and after we found the projection operator $P$ for $W^{per}$ the projection operator for $W$ is $I-P$ as for any vector $x$ the projection would be: $(I-P)x = x-Px$ which is the part perpendicular to the projection on $W^{per}$ Commented Mar 12, 2016 at 15:07

One normal vector to the plane is ${\bf n} = (1,-1,-1)$. I want to take a point $(x,y,z) \in \Bbb R^3$, consider the line through this point with direction $\bf n$, and see where it hits the plane. We have the line: $${\bf X}(t) = (x+t,y-t,z-t), \quad t \in \Bbb R.$$ I want $t_0$ such that ${\bf X}(t_0)$ satisfies the plane equation. So the relation we have is: $$x+t_0 - (y-t_0) - (z-t_0)=0 \implies x-y-z+3t_0 = 0 \implies t_0 = \frac{-x+y+z}{3}.$$ With this, $P(x,y,z) = \left(x+\frac{-x+y+z}{3}, y - \frac{-x+y+z}{3}, z - \frac{-x+y+z}{3}\right)$. We have \begin{align}P(1,0,0) &= (2/3, 1/3, 1/3) \\ P(0,1,0) &= (1/3, 2/3, -1/3) \\ P(0,0,1) &= (1/3,-1/3, 2/3)\end{align}, so the matrix would be: $$A = \frac{1}{3}\begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & -1 \\ 1 & -1 & 2\end{pmatrix}.$$

In general you can write the projection matrix very easily using an arbitrary basis for your subspace. Look at this.

$$x-y-z=0\Longrightarrow x=y+z$$ $$\{\begin{bmatrix} 1\\ 1\\ 0\end{bmatrix},\begin{bmatrix} 1\\ 0\\ 1\end{bmatrix}\}$$

Now let $A:=\begin{bmatrix} 1 & 1\\ 1 & 0\\ 0 & 1\end{bmatrix}$, your projection matrix is $A(A^tA)^{-1}A^t$. Computing it by hand is not hard but I prefer to put the Maple computation for you here:

A := Matrix([[1, 1], [1, 0], [0, 1]]);
P := A.MatrixInverse(Transpose(A).A).Transpose(A);


The result is: $$\begin{bmatrix} \frac{2}{3} & \frac{1}{3} & \frac{1}{3}\\ \frac{1}{3} & \frac{2}{3} & -\frac{1}{3}\\ \frac{1}{3} & -\frac{1}{3} & \frac{2}{3}\end{bmatrix}$$

Now the matrix you showed at the end of your question. If you extend an arbitrary basis of $W$ which of course it has 2 elements, to a basis for $\mathbb{R}^3$ and then indexing these three vectors in the way that the new added vector be the first then representation of $P$ in this new ordered basis is $\begin{bmatrix}0 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\end{bmatrix}$ because say $B:=\{v_1,v_2,v_3\}$ be this ordered basis then basis of $W$ is $\{v_2,v_3\}$, in the new coordinate: $$v_2=0v_1+1v_2+0v_3\longrightarrow v_2=\begin{bmatrix}0\\ 1\\ 0\end{bmatrix}$$ $$v_2=0v_1+0v_2+1v_3\longrightarrow v_2=\begin{bmatrix}0\\ 0\\ 1\end{bmatrix}$$ Now letting $A:=\begin{bmatrix} 0 & 0\\ 1 & 0\\ 0 & 1\end{bmatrix}$ We have:

A := Matrix([[0, 0], [1, 0], [0, 1]]);
P := A.MatrixInverse(Transpose(A).A).Transpose(A);


The result is: $$\begin{bmatrix} 0 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\end{bmatrix}$$

But pay attention this representation of $P$ is not in the standard coordinate, it is in the new coordinate system given by the ordered basis $B$.

Assuming you are searching an orthogonal projection the other answers are good. But the text of your problem request a generic projection on a plane where $x=y+z$, so a solution is the matrix: $$\left [ \begin{array}{cccc} 0&1&1\\ 0&1&0\\ 0&0&1 \end {array} \right ]$$

Your matrix $A$ is a projection on the plane $x=0$.

• Can you elaborate please. How did you get that matrix? Commented Feb 9, 2015 at 16:30
• Given a vector $(x,y,z)^T$ the projection gives $(y+z,y,z)^T$. So the representative matrix must have the first row that take $y$ and $z$ and sum them, and must be $(0,1,1)$, the second row takes only $y$ and is $(0,1,0)$ and the third takes $z$ and is $(0,0,1)$. Commented Feb 9, 2015 at 16:59
• The vectors in your question are a basis for the given plane and, yes, they are the second and third columns of the matrix, the first being $(0,0,0)^T$ since the projecton "crushes" one dimension on the plane. Commented Feb 9, 2015 at 17:14