Give the standard matrix of the projection $T:\Bbb R^3 \to \Bbb R^3$ that projects a vector on the plane $x+y+z=0$ I'm trying to figure this one out guys with no luck.
Give the standard matrix of the projection 
$$
T:\Bbb R^3 \to \Bbb R^3
$$ 
that projects a vector on the plane $x+y+z=0.$
I tried to make a basis $B$, for instance $(-1,0,1)$ and $(0,1,-1)$ then make them orthogonal using Gram-Schmidt, then make the projection $$\frac{(x,y,z) \cdot (-1,0,1)}{(-1,0,1)\cdot(-1,0,1)} + \frac{(x,y,z) \cdot (0,1,-1)}{(0,1,-1)\cdot(0,1,-1)}$$ After this I'm lost
I'm taking a linear algebra course, so an answer in that field would be much appreciated prefferably using the method I used. Thanks in advance!
 A: Let $\theta_{\mathbf{u},\mathbf{v}}$ be the smallest angle between $\mathbf{u}$ and $\mathbf{v}$. Define the ortogonal projection of a vector $\mathbf{u}$ over a vector $\mathbf{v}$ as:
$$ {Pr}_{\mathbf{v}}(\mathbf{u})= \frac{\vert\vert\mathbf{u}\vert\vert\cdot\cos\left(\theta_{\mathbf{u},\mathbf{v}}\right)}{\vert\vert\mathbf{v}\vert\vert}\frac{\mathbf{v}}{\vert\vert\mathbf{v}\vert\vert}$$
also 
$$ \langle \mathbf{u},\mathbf{v} \rangle = \vert\vert\mathbf{u}\vert\vert\cdot\vert\vert\mathbf{v}\vert\vert\cdot\cos\left(\theta_{\mathbf{u},\mathbf{v}}\right)$$
$$ \langle \mathbf{v},\mathbf{v}\rangle= \vert\vert\mathbf{v}\vert\vert^{2}$$
then
$${Pr}_{\mathbf{v}}(\mathbf{u})=\frac{\langle \mathbf{u},\mathbf{v}\rangle}{\langle \mathbf{v},\mathbf{v}\rangle}\mathbf{v}$$
Take $u=(x,y,z)$ and $v=(1,1,1)$ the normal vector of the plane $x+y+z=0$. So, the linear projection $T$ will be
$$T(\mathbf{u}):=\mathbf{u}-{Pr}_{\mathbf{v}}(\mathbf{u})$$
$$ \langle \mathbf{u}, \mathbf{v}\rangle = x+y+z.$$
$$ \langle \mathbf{v},\mathbf{v} \rangle = \vert\vert\mathbf{v} \vert\vert^{2}=3.$$
Then 
$$ T(x,y,z) = (x,y,z) - \frac{(x+y+z)}{3}(1,1,1) =\left(\frac{2x-y-z}{3},\frac{2y-x-z}{3},\frac{2z-x-y}{3}\right)$$
So your matrix is
$$ A = \frac{1}{3}\left[
\begin{array}{ccc}
2&-1&-1\\
-1&2&-1\\
-1&-1&2
\end{array}
\right]$$
You can check that $A^{2}=A$. Also, you can check that $T(1,1,1)=(0,0,0)$, that is,
$$
\mathrm{ker}(T)=\mathrm{span}\{(1,1,1)\}
$$ 
and $$\mathrm{Im}(T)=\{(x,y,z)\in\mathbb{R}^{3}\ :\ x+y+z=0\}$$ (your initial plane).
Recall that:  

The vector $\mathbf{w} = \mathbf{u} - Pr_{\mathbf{v}}(\mathbf{u})$ will satisfy $\langle \mathbf{w},\mathbf{v}\rangle=0.$

A: You can obtain  the matrix  w.r.t. the canonical basis in a simpler way:
Let $n=(1,1,1)$ be a normal vector of the plane $\Pi:\;x+y+z=0$. For any point $M=(x,y,z)\in\mathbf R^3$,  its orthogonal projection on $\pi$ is defined by the value of the parameter $t$ such that $M+tn$ satisfies the equation of $\Pi$, i.e.
$$ (x+t)+(y+t)+(z+t)=0. $$
Can you proceed?
Some details:
The latter equation yields the value of $\:t=-\frac13(x+y+z)$, and the point $T(M)=M+tn$ has coordinates:
\begin{cases}
x'=x+t=\tfrac13(2x-y-z),\\
y'=y+t=\tfrac13(-x+2y-z),\\
z'=z+t=\tfrac13(-x-y+2z).
\end{cases}
It is now easy to deduce the matrix of T in the canonical basis.
A: Partial answer, to push you along in the direction you were going.
Finding a basis for the plane you're projecting to is a good idea. You started with 
$$
u_1 = \pmatrix{-1\\0\\1} , u_2 = \pmatrix{0 \\ 1 \\ -1}
$$
and then wanted to apply Gram-Schmidt. Normalizing the first gives you 
$$
v_1 = \pmatrix{-s\\0\\s} , u_2 = \pmatrix{0 \\ 1 \\ -1}
$$
where $s = \frac{\sqrt{2}}{2}$. The problem is that the dot product with the second is not zero, so you don't have perpendicular vectors. The dot product is ... $-s$. 
The idea in G-S is to alter $u_2$, by adding some multiple of $v_1$, until the result is perpendicular to $v_1$. In other words, you want to find a number $b$ with 
$$
(u_2 + b v_1) \cdot v_1 = 0.
$$
That turns into 
\begin{align}
u_2 \cdot v_1 + b (v_1 \cdot v_1) &= 0 \\
-s + b (1) &= 0 \\
\end{align}
so $b = s$. So we compute 
\begin{align}
u_2 + s v_1
&= \pmatrix{0\\1\\-1} + s \pmatrix {-s\\0\\s} \\
&= \pmatrix{-s^2\\1\\-1+s^2}\\
&= \pmatrix{-\frac12\\1\\-\frac12},
\end{align}
which you can see is orthogonal to $v_1$. But this isn't quite the final step. That vector we found wasn't a unit vector (i.e., its length was not $1$). In fact, its length is $\sqrt{1^2 + (\frac12)^2 + (\frac12)^2} = \sqrt{\frac{3}{2}} = \frac{\sqrt{3}}{s}$. We need to divide the vector by this length to get the unit vector $v_2$:
\begin{align}
v_2 
&= \pmatrix{-\frac12\\1\\-\frac12} / (\frac{\sqrt{3}}{s}) \\
&= \frac{s}{\sqrt{3}}\pmatrix{-\frac12\\1\\-\frac12}\\
\end{align}

Whew! So now we have an orthonormal basis for the plane we're projecting on. We can extend it to an orthonomal basis for all of 3-space by adding in $\pmatrix{1\\1\\1}$...almost. That vector isn't a unit vector, so we have to add in 
$$
v_3 = \frac{1}{\sqrt{3}}\pmatrix{1\\1\\1}
$$
Now you have an orthonormal basis $v_1, v_2, v_3$ for $3$-space, where the first two vectors span the plane that you want to project onto. 
Can you do anything with this? 
