I was asked to find orthogonal projection matrix in some basis, that projects onto $W: x_1+2x_2-3x_3=0$ and give the vectors for this basis I am using.
So first I noticed that $\{(-2,1,0), (3,0,1)\}$ spans $W$ then I used Gram-Schmidt process to find $\{u_1, u_2\}$ orthogonal basis. So I took $$u_1=(-2,1,0) \\u_2=(3,0,1)-\langle (-2,1,0),(3,0,1)\rangle\frac{(-2,1,0)}{\langle(-2,1,0),(-2,1,0)\rangle}=\left(\frac{3}{5},\frac{6}{5},1\right)$$
finaly I formed matrix $A=(u_1|u_2)$ and found Projection matrix $P=A(A^TA)^{-1}A^T$ I got something pretty ugly so I assume I made a mistake somwhere in reasoning or calculation. The questions are:
- Was it reasoning or calculation?
- Should I get a symmetric matrix (since basis is orthogonal)?
- Should the trace be in $\mathbb{Z}$ since eigenvalues of a projections are from the set $\{0,1,-1\}$ and projections are diagonalizable (I remember something like this, but even if they are not always diagonalizable in Jordan form they also have eigenvalues on the diagonal so my claim still holds)?
And extra question: In fact the most interesting for me.
Here Matrix of orthogonal projection User Evan Delanoy solved similar problem using normal vector to instead of basis of $W$. The way he solved it is more appealing to me than my solution, however he could not specify with respect to what basis is the matrix he obtained. Does anyone know how could I specify what basis I am working on while solving the problem using his way?
Original answer
A basis for $W$ is obtained by solving $x_1=-x_2+x_3$: $$ \left\{\, \begin{bmatrix} -1 \\ 1 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 0 \\ 1 \end{bmatrix} \,\right\} $$ I don't know how you got those two vectors, which aren't in $W$ to begin with.
Applying Gram-Schmidt, we get the normalized vectors $$ u_1=\begin{bmatrix} -1/\sqrt{2} \\ 1/\sqrt{2} \\ 0 \end{bmatrix},\qquad u_2=\begin{bmatrix} 1\sqrt{6} \\ 1/\sqrt{6} \\ 2/\sqrt{6} \end{bmatrix} $$ If $Q=[u_1\ u_2]$, then $$ QQ^T=\begin{bmatrix} 2/3 & -1/3 & 1/6 \\ -1/3 & 2/3 & 1/6 \\ 1/6 & 1/6 & 2/3 \end{bmatrix} $$ is the projection matrix. The trace is indeed $2$, because the eigenvalues are $0$ (single) and $1$ (double).
After edit to the question
The basis you found is correct; now normalize the two vectors and consider $$ Q=\begin{bmatrix} -2/\sqrt{5} & 3/\sqrt{70}\\ 1/\sqrt{5} & 6/\sqrt{70}\\ 0 & 5/\sqrt{70} \end{bmatrix} $$ and compute the projection matrix ax $QQ^T$; you should get $$ \begin{bmatrix} 13/14 & -1/7 & 3/14\\ -1/7 & 5/7 & 3/7\\ 3/14 & 3/7 & 5/14 \end{bmatrix} $$ whose trace is $2$.