# Matrix of the perpendicular Projection

I am bit doubtful about my reasoning so I hope there's someone that will correct me if I'm wrong on the steps 1 to 3.

Given is:

$W = span(v_1, v_2)$

with:

$v_1 = \begin{bmatrix} 1\\0\\1\\0 \end{bmatrix}, v_2 = \begin{bmatrix} 1\\-1\\1\\-1 \end{bmatrix}$

Steps:

i)

I use the Gram-Schmidt process to find an orthonormal basis which, using $v_1$ as $b_1$(first vector), is

$W = span\{1/\sqrt{2}\begin{bmatrix}1\\0\\1\\0 \end{bmatrix};1/\sqrt{2}\begin{bmatrix}0\\-1\\0\\-1\end{bmatrix} \}$

ii)

I find the the Matrix of the orthogonal reflection relative to the canonical basis:

$M = 1 - 2n^Tn$, I could choose either of the two vector, and I choose $b_1$.

$M = I - 2(1/\sqrt{2})(1/\sqrt{2})\begin{bmatrix}1\\0\\1\\0 \end{bmatrix}\begin{bmatrix}1&0&1&0\end{bmatrix}$

$M = \begin{bmatrix}0&0&1&0\\0&1&0&0\\1&0&0&0\\0&0&0&1\end{bmatrix}$

iii)

I should compute the Matrix of the perpendicular projection relative to the canonical basis, $proj_w : V \to V$ on $W$.

I thought I should compute $<x,b_1>b_1 + <x,b_2>b_2$ with $b_j$ being a vector of the orthonormal basis found at step 1 and $x$ being $x =(x_1,x_2,x_3,x_4)$ and that should be it, but I'm very unsure.

Yes, your reasoning is correct for iii). The columns of the matrix are the images of the canonical basis, so the first column is

$$\langle e_1, b_1 \rangle b_1 + \langle e_1, b_2 \rangle b_2 = \frac{1}{\sqrt{2}} b_1$$

and similarly for $e_2, e_3, e_4$.

• Shouldn't it be $1/2b_1$ ? – Leroy Sep 2 '17 at 21:32
• @Leroy No, it is $(1/\sqrt(2)) b_1 = (1/2)(1,0,1,0)^\top$ because $\langle e_1, b_1\rangle = (1/\sqrt(2))(1+0+0+0)$. – Gribouillis Sep 3 '17 at 5:38

Your reasoning for part (iii) is correct. In fact, it’s a general principle that you can use to construct transformation matrices: the columns of the matrix are the images of the basis vectors.

On the other hand, your solution for part (ii) has some issues. First of all, you’ve made some sign errors in your computation. $$I-2{1\over\sqrt2}{1\over\sqrt2}\begin{bmatrix}1\\0\\1\\0\end{bmatrix}\begin{bmatrix}1&0&1&0\end{bmatrix}=\begin{bmatrix}0&0&-1&0\\0&1&0&0\\-1&0&0&0\\0&0&0&1\end{bmatrix}.$$ However, you’re also making a more fundamental error (at least as far as I understand what you’re trying to do): $(n^Tv)n$ is the orthogonal projection of $v$ onto $n$, so $I-2nn^T$ is the matrix of the reflection in the hyperplane that’s the orthogonal complement of $n$, i.e., the hyperspace for which $n$ is a normal. One way to tell that neither matrix is correct is to examine their determinants. The eigenvalues of a reflection in a two-dimensional subspace of $\mathbb R^4$ are $1$, $1$, $-1$ and $-1$, which means that the determinant of the matrix should be $1$, but $\det M=-1$ for both your matrix and the correctly-computed value of $I-2nn^T$. You could also test the matrix that you computed against elements of $W^T$. Applying $M$ to elements of this subspace should be equivalent to multiplication by $-1$. You can easily find that $W^\perp$ is spanned by $(0,-1,0,1)^T$ and $(-1,0,1,0)^T$. Using your $M$, we have $M(0,-1,0,1)^T=(0,-1,0,1)^T$, which is not what we want. On the other hand, the matrix with the correct signs gives reverses $(1,0,1,0)^T$, which is also not what we want.

Once you have the orthogonal projection $\mathbf\pi_W$ onto $W$, constructing the reflection in $W$ is fairly easy using a similar derivation to the one that leads to the formula you’re using. Decompose $v$ into $v_\perp+v_\parallel$, its components orthogonal to and parallel to $W$. Reflection in $W$ amounts to reversing the orthogonal component, i.e., $R_Wv=v-2v_\perp$, but $v_\perp=v-v_\parallel=v-\mathbf\pi_Wv$, so $$R_Wv = v-2(v-\mathbf\pi_wv) = 2\mathbf\pi_Wv-v,$$ which gives for the reflection matrix $R_W=2\mathbf\pi_W-I$. If you have an orthonormal basis $\{w_1,w_2\}$ for $W$, this can be constructed directly as $$R_W=2w_1w_1^T+2w_2w_2^T-I,$$ but since you’re also computing the projection onto $W$, you might as well just do that first.