\documentclass{article}
\usepackage{amssymb}

% write-up for futher homework, OP



% feel and look

\setlength{\textwidth}{15.9cm}
\setlength{\textheight}{23cm}
\setlength{\hoffset}{-1.7cm}
\setlength{\voffset}{-1.8cm}
\setlength{\parskip}{2mm}
\setlength{\parindent}{0mm}
\renewcommand{\baselinestretch}{1.3}

\newcommand{\qed}{\nolinebreak\mbox{\hspace{5 true pt}%
  \rule[-0.85 true pt]{3.9 true pt}{8.1 true pt}}}
\newcommand{\problem}[2]{\noindent\textbf{Exercise #1:} #2\qed\\[3mm]} 
\newcommand{\Matrix}[2]{\left[\begin{array}{#1} #2\end{array}\right]}
\newcommand{\Det}[2]{\left|\begin{array}{#1} #2\end{array}\right|}
\newcommand{\B}[1]{{\bf #1}}
\newcommand{\I}[1]{{\mathbb #1}}
\newcommand{\Col}{\mathrm{Col}}
\newcommand{\Nul}{\mathrm{Nul}}
\newcommand{\Span}{\mathrm{Span}}

\newcommand{\PB}{\newpage {\Huge Sample Solutions}}

\pagestyle{empty}

\begin{document}

%\PB\enlargethispage{10mm}

\section*{Section 6.1}

\problem{10}{Find a unit vector $\B u$ in the direction of the given vector
 $$
 \B w=\Matrix{r}{-6\\4\\-3}.
 $$

 
\emph{Solution.} There are two solutions:
 $$
 \B u=\frac{\pm 1}{\|\B w\|}\, \B w =\frac{\pm1}{\sqrt{36+16+9}}\,
\Matrix{r}{-6\\4\\-3} = \pm
 \Matrix{r}{-6/\sqrt{61}\\4/\sqrt{61}\\-3/\sqrt{61}}.
 $$
}

\problem{24}{Verify the \emph{paralellogram law}
 $$
 \|\B u+\B v\|^2 +\|\B u-\B v\|^2=2\|\B u\|^2+2\|\B v\|^2.
 $$

\emph{Solution.} Let $\B
u=(u_1,\dots, u_n)$ and $\B v=(v_1,\dots,v_n)$. We have
 $$
  \|\B u+\B v\|^2 +\|\B u-\B v\|^2 =\sum_{i=1}^n (u_i+v_i)^2 + \sum_{i=1}^n
  (u_i- v_i)^2 =\sum_{i=1}^n (2u_i^2+2v_i^2) = 2\|\B u\|^2+2\|\B v\|^2.
 $$
 (Here we used the simple identity $(a+b)^2+(a-b)^2=2a^2+2b^2$ valid for any
scalars  $a,b$.)} 


\section*{Section 6.2}

\problem{30}{Let $U$ be orthonormal matrix, and construct $V$ by interchanging
some of the rows of $U$. Explain why $V$ is orthonormal.\medskip

\emph{Solution 1.} Let us recall some implications proved in the class. By
definition, a matrix $U$ is orthogonal if and only if $U^TU=I$. Since both $U$
and $U^T$ are square matrices, the latter identity is equivalent to $UU^T=I$
by the Invertible Matrix Theorem. But $UU^T=I$ is equivalent to the rows of
$U$ being orthonormal.

In summary, $U$ is othogonal if and only if its rows are
orthonormal. The latter property is clearly preserved by any row
permutation.\medskip 

\emph{Solution 2 (or rather a hint).} Observe that the dot product $\B x\cdot
\B y$ does not change if the entries of $\B x$ are permuted in the same way as
the entries of $\B y$.}

\PB

\section*{Section 6.3} 

\problem{7}{Let $W=\Span\{\B u_2,\B u_2\}$. Write $\B y$ as the sum of a
  vector in $W$ and a vector orthogonal to $W$. Here
 $$
 \B y=\Matrix{r}{1\\3\\5},\quad \B u_1=\Matrix{r}{1\\3\\-2},\quad \B
u_2=\Matrix{r}{5\\1\\4}.
 $$ 

\emph{Solution.} The vectors $\B u_1$ and $\B u_2$ are orthogonal to each
other. First we compute $\hat{\B y}$, the  orthogonal projection of
 $\B y$ onto $W$:
 $$
 \hat{\B y} = \frac{1+9-10}{1+9+4}\,\B u_1 +\frac{5+3+20}{25+1+16}\,\B u_2 =
 0\,\B u_1+\frac{2}{3}\, \B u_2 =\Matrix{c}{10/3\\2/3\\8/3}.
 $$
 Let $\B v=\B y-\hat{\B y} = (-7/3,7/3,7/3)$. Then $\B y =\hat{\B y}+\B v$ is the required
sum.} 


\problem{8}{Let $W=\Span\{\B u_2,\B u_2\}$. Write $\B y$ as the sum of a
  vector in $W$ and a vector orthogonal to $W$. Here
 $$
 \B y=\Matrix{r}{-1\\4\\3},\quad \B u_1=\Matrix{r}{1\\1\\1},\quad \B
 u_2=\Matrix{r}{-1\\3\\-2}.
 $$

\emph{Solution.} The vectors $\B u_1$ and $\B u_2$ are orthogonal to each
other. First we compute $\hat{\B y}$, the  orthogonal projection of
 $\B y$ onto $W$:
 $$
 \hat{\B y} = \frac{-1+4+3}{1+1+1}\,\B u_1 +\frac{1+12-6}{1+9+4}\,\B u_2 =
 2\,\B u_1+\frac{1}{2}\, \B u_2 =\Matrix{c}{3/2\\ 7/2\\ 1}.
 $$
 Let $\B v=\B y-\hat{\B y} = (-5/2,1/2,2)$. Then $\B y =\hat{\B y}+\B v$ is the required
sum.}
 
 
\section*{Section 6.4}

\problem{10}{Find an orthogonal basis for the column space of
 $$
 A=[\B x_1\ \B x_2\ \B x_3]=\Matrix{rrr}{-1&6&6\\ 3&-8&3\\1&-2&6\\ 1&-4&-3}.
 $$

\emph{Solution.} We apply the Gram-Schmidt process. We let $\B v_1=\B
x_1$. Also,
 $$
 \B v_2=\B x_2 - \frac{-6-24-2-4}{1+9+1+1}\,\B v_1 = \B x_2 + 3 \B
 v_1=\Matrix{r}{3\\1\\1\\-1}.
 $$
 Finally, we should let
 $$
 \B v_3 = \B x_3- \frac{-6+9+6-3}{1+9+1+1}\, \B v_1 -
\frac{18+3+6+3}{9+1+1+1}\, \B v_2 =\B x_3-\frac12\, \B v_1 - \frac{5}2\, \B
 v_2 =\Matrix{r}{-1\\ -1\\ 3\\ -1}.
$$
 A routine checking shows that the obtained vectors $\B v_1,\B v_2,\B v_3$ are
indeed orthogonal.}


\section*{Section 6.5}

\problem{12}{Find (a) the orthogonal projection of $\B b$ into $\Col A$ and (b)
a least-square solution of $A \B x=\B b$. Here
 $$
 A=[\B v_1\ \B v_2\ \B v_3]=\Matrix{rrr}{1&1&0\\ 1&0&-1\\ 0&1&1\\ -1&1&-1},\quad \B
 b=\Matrix{r}{2\\5\\6\\6}.
 $$

\emph{Solution.} It is easy to check that the columns of $A$ are orthogonal to
each other. (In particular, they are linearly independent.) Hence, we can use
the standard formulas for finding the orthogonal projection of $\B b$ onto
$\Col A$:
 $$
 \hat {\B b} = \frac{2+5-6}{1+1+1}\B v_1 + \frac{2+6+6}{1+1+1}\B v_2 +
\frac{-5+6-6}{1+1+1}\B v_1 = \frac13 (\B v_1 + 14\B v_2 -5\B v_3) =
\Matrix{c}{5\\ 2\\3\\6}.
 $$
 This answers (a). Since the columns of $A$ are linearly independent, the
least-square solution $\B x$ is unique and we already know the weights, namely
$\B x(=1/3,14/3,-5/3)$. 

As an check, one can compute $\B b-\hat {\B b}=(-3,3,3,0)$ and see that it is
 indeed orthogonal to each $\B v_i$.}


\end{document}
