# Orthogonal complement and projection

Let $M$ be a subspace of $\mathbb R^4$ which is spanned by the vectors $v_1 = (1,0,-1,1)$ , $v_2=(0,1,2,1)$. Find the orthogonal complement $M^T$ of $M$ and the orthogonal projections of the vector $v=(4,3,0,1)$ on the subspaces $M,M^T$.

My solution for the first part :

Let $A=[v_1 | v_2]$, $v_1,v_2$ are already in an opened-form and linearly independent and thus solving : $A\vec x=0$ yields : $\{x - z + w = 0, y + 2z + w = 0\}$ which gives you two linearly independent vectors : $v_3,v_4$ : $v_3 = (1,-2,0,1)$,$v_4=(0,-3,1,1)$ and we get that : $M^T = span(v_3,v_4) = \langle v_3,v_4\rangle=\langle (1,-2,0,1),(0,-3,1,1) \rangle.$

Now, I have trouble finding (I do not know in that case) how to work for the orthogonal projection for the second part. Does it have to do with the Gram-Schmidt procedure ? I would appreciate a hint or an explanation on how to work over finding the orthogonal projections generally or in that example. Thanks in advance.

• For working out the projection, the standard, strainght-forward way is to Gram-Schmidt-reduce your two bases to orthonormal ones, and then Gram-Schmidt-reduce $v$ to either of them. – Arthur Jun 19 '16 at 7:31
• @Arthur So I will apply Gram-Schmidt to $v_1,v_2$ and to $v_3,v_4$ first ? And then apply Gram-Schmidt to the vectors $v,v'_1,v'_2$ and $v,v'_3,v'_4$ ? – Rebellos Jun 19 '16 at 7:37
• Yes, that would be the standard solution. There is probably some clever way to do it without having to apply GS for times, but I can can't come up with anything right now. – Arthur Jun 19 '16 at 7:39
• @Arthur Okay mate, thanks a lot ! No problem, I just wanted to be sure I was approaching it correctly because I am gathering exercise parts for my exams! Thanks a lot once again. – Rebellos Jun 19 '16 at 7:40
• There is an alternative way which is commonly used in statistics. Let X be the matrix consists of column vectors $v1$ and $v2$. Then the projection matrix onto M is $X(X'X)^{-1}X'$ . – Deepleeqe Jun 19 '16 at 7:58

## 3 Answers

If you have, say a $4$ by $4$ square matrix that's represendted by $A=[c_1,c_2,c_3,c_4]$ where $c_i$'s are colums, then you now that given a column vector $v$, $Av=\sum_i c_iv_i$ where $v_i$ are elements of $v$.

So by finding basese for $M^T$ and $M$ you know basis for whole space since $\mathbb{R}^4=M^T \oplus M$ and to find projection of some vector $v$ onto these spaces you need to represent $v$ in terms of these basis vectors. So you are trying to find $a_i$ such that $[v_1,v_2,v_3,v_4] a = v$ where $a$ is column vector with elements $a_i$ and $v_i$ are bases vectors in column form.

Since you know $v_i$'s are linearly independent you know $A=[v_i]$ is an invertible matrix, and inverse can easily be found using Gaussian elimination - so you can easily find $a$, and you are done

For a linearly-independent set of vectors, let $M$ be a matrix with these vectors as columns. Then, $\pi=M(M^TM)^{-1}M^T$ is the matrix of the orthogonal projection onto their span. The orthogonal complement of their span is the kernel of $\pi$, and projection onto this complement is the orthogonal rejection $I-\pi$.

The orthogonal projection of $x$ onto $M$ is the unique $m\in M$ such that $$(x-m)\perp M.$$ If $x = [x_1,x_2,x_3,x_4]^{T}$, then finding the orthogonal projection requires finding constants $\alpha$, $\beta$ such that $$\left(\left[\begin{array}{c}x_1\\x_2\\x_3\\x_4\end{array}\right]-\alpha\left[\begin{array}{r}1\\0\\-1\\1\end{array}\right]-\beta\left[\begin{array}{c}0\\1\\2\\1\end{array}\right]\right)\perp M.$$ The constants $\alpha$, $\beta$ are the solutions of a $2\times 2$ system; two independent equations are found by dotting the expression in parentheses with the two basis elements of $M$: $$x_1-x_3+x_4-3\alpha+\beta = 0 \\ x_2+2x_3+x_4+\alpha-6\beta = 0.$$ Multiplying the first equation by 6 and adding the second gives $\alpha$: $$6x_1+x_2-4x_3+7x_4-17\alpha = 0 \\ \alpha = \frac{1}{17}\{6x_1+x_2-4x_3+7x_4\}$$ Multiplying the second by 3 and adding the two gives $\beta$: $$x_1+3x_2+5x_3+4x_4-17\beta = 0 \\ \beta = \frac{1}{17}\{x_1+3x_2+5x_3+4x_4\}$$ So the orthogonal projection $P$ onto $M$ is \begin{align} Px & = \alpha\left[\begin{array}{r}1\\0\\-1\\1\end{array}\right]+\beta\left[\begin{array}{c}0\\1\\2\\1\end{array}\right] \\ & = \frac{1}{17}\left[\begin{array}{c} 6x_1+x_2-4x_3+7x_4 \\ x_1+3x_2+5x_3+4x_4 \\ -4x_1+5x_2+14x_3+x_4 \\ 7x_1+4x_2+x_3+7x_4 \end{array}\right] \\ & = \frac{1}{17}\left[\begin{array}{rrrr} 6 & 1 & -4 & 7 \\ 1 & 3 & 5 & 4 \\ -4 & 5 & 14 & 1 \\ 7 & 4 & 1 & 11 \end{array}\right]\left[\begin{array}{c} x_1\\x_2\\x_3\\x_4\end{array}\right]. \end{align} The orthogonal projection onto $M^\perp$ is $I-P$.