# The Orthogonal Projection Matrix Sizes not working out

I need to find the orthogonal projection matrix given the system of linear equations:

$x_1 + x_2 - x_3 = 0 \\ x_1 - x_2 + 3x_3 = 0 \\$

Which gives the following matrix:

$\begin{bmatrix} 1 & 1 & -1 & 0\\ 1 & -1 & 3 & 0\\ \end{bmatrix}$

With reduced row echelon form:

$\begin{bmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & -2 & 0\\ \end{bmatrix}$

Making the solutions

$\begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ \end{bmatrix} = x_3 \begin{bmatrix} -1 \\ 2 \\ 1 \\ \end{bmatrix}$

So in order to find the orthogonal projection matrix, I use the following equation.

$P_W = C(C^TC)^{-1}C^T$

Where $C$ equals the basis which is $\begin{bmatrix} -1 \\ 2 \\ 1 \\ \end{bmatrix}$ correct?

So plugging in C into the equation $P_W$ and solving, I get

$\begin{bmatrix} 1/3 & 2/3 & 1/3 \\ \end{bmatrix}$

But the book says the answer is

$P_W = 1/6 \begin{bmatrix} 1 & -2 & -1\\ -2 & 4 & 2\\ -1 & 2 & 1\\ \end{bmatrix}$

I don't know how they got that. I'm not getting the same answer. Is my basis wrong to begin with?

$C^TC$ is just a scalar, so you’re effectively multiplying a $3\times1$ matrix by a $1\times3$ matrix. The result should be a $3\times3$ in which the elements are all of the possible products of pairs of elements of $C$. It looks like you might have ended up simply squaring each component of $C$ of instead.