# Shouldn't the trace of an orthogonal projector be in $\mathbb{N}$?

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:

1. Was it reasoning or calculation?
2. Should I get a symmetric matrix (since basis is orthogonal)?
3. 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?

• @ArnaudD. yeah right now they are. I misquoted the exercise, I've just corrected it.
– Kran
Commented Jun 14, 2018 at 11:27
• How can a projection have $-1$ as an eigenvalue? It satisfies $P^2=P$, so the minimal polynomial can’t have $\lambda+1$ as a factor.
– amd
Commented Jun 15, 2018 at 6:14
• $\operatorname{tr}P = \dim W$. The restriction of $P$ to $W$ is the identity map and $P$’s rank is of course equal to $\dim W$. The matrix in Delanoy’s answer is clearly expressed relative to the same basis that was used to define $W$, which he assumes to be orthonormal since he interprets the defining equation as an inner product.
– amd
Commented Jun 15, 2018 at 6:20

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$.

• sorry there was a mistake I already edited the post
– Kran
Commented Jun 14, 2018 at 11:25
• I misquoted the exercise the W equation is different. I've just corrected it now and should be alright.
– Kran
Commented Jun 14, 2018 at 11:29
• @Kacper The basis you find is good. Just do the computation in the easier way shown in my answer. Commented Jun 14, 2018 at 12:51