\documentclass[12pt]{article}
\input{../macros.tex}
\begin{document}

\thispagestyle{plain}

\setcounter{session}{26}
\begin{center}
\textbf{Exercises on change of basis; image compression}
\end{center}


\begin{problem}  Verify that the vectors of the Haar wavelet basis, given in lecture, are orthogonal. Adjust their lengths so that the resulting basis vectors are orthonormal.
\end{problem}

\solution{
The vectors given for the Haar wavelet basis were:
$$\left[\begin{array}{r}1\\1\\1\\1\\1\\1\\1\\1\end{array}\right], 
\left[\begin{array}{r}1\\1\\1\\1\\-1\\-1\\-1\\-1\end{array}\right], 
\left[\begin{array}{r}1\\1\\-1\\-1\\0\\0\\0\\0\end{array}\right], 
\left[\begin{array}{r}0\\0\\0\\0\\1\\1\\-1\\-1\end{array}\right], 
\left[\begin{array}{r}1\\-1\\0\\0\\0\\0\\0\\0\end{array}\right],
\left[\begin{array}{r}0\\0\\1\\-1\\0\\0\\0\\0\end{array}\right],
\left[\begin{array}{r}0\\0\\0\\0\\1\\-1\\0\\0\end{array}\right],
\left[\begin{array}{r}0\\0\\0\\0\\0\\0\\1\\-1\end{array}\right].$$

It's easy to see that the second through eighth vectors are orthogonal
to the first; their inner products are sums of equal numbers of ones
and negative ones.
The same thing happens when taking the dot products of the third through eighth vectors with the second.
The remaining inner products are either sums of equal numbers of ones
and negative ones or simply sums of zeros.
Since all the pairwise inner products are zero, the vectors are orthogonal.

\bigskip

To make the basis orthonormal, divide by the lengths of the vectors:
\begin{scriptsize}
$$\left[\begin{array}{r}1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\end{array}\right], 
\left[\begin{array}{r}1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\\1/\sqrt{8}\\-1/\sqrt{8}\\-1/\sqrt{8}\\-1/\sqrt{8}\\-1/\sqrt{8}\end{array}\right], 
\left[\begin{array}{r}1/2\\1/2\\-1/2\\-1/2\\0\\0\\0\\0\end{array}\right], 
\left[\begin{array}{r}0\\0\\0\\0\\1/2\\1/2\\-1/2\\-1/2\end{array}\right], 
\left[\begin{array}{r}1/\sqrt{2}\\-1/\sqrt{2}\\0\\0\\0\\0\\0\\0\end{array}\right],
\left[\begin{array}{r}0\\0\\1/\sqrt{2}\\-1/\sqrt{2}\\0\\0\\0\\0\end{array}\right],
\left[\begin{array}{r}0\\0\\0\\0\\1/\sqrt{2}\\-1/\sqrt{2}\\0\\0\end{array}\right],
\left[\begin{array}{r}0\\0\\0\\0\\0\\0\\1/\sqrt{2}\\-1/\sqrt{2}\end{array}\right].$$
\end{scriptsize}
}

\begin{problem} 
We can think of the set of all two by two matrices with real valued entries as a vector space. Describe two different bases for this space. Is one of your bases better than the other for describing diagonal matrices? What about triangular matrices? Symmetric matrices? 
\end{problem}

\solution{
There are many different ways to answer this question correctly.

The most obvious choice of basis is: $$\twobytwo 1000, \twobytwo 0100, \twobytwo 0010, \twobytwo 0001.$$

Hopefully, the second basis you chose differs from this one significantly. Here are some possibilities:
$$\twobytwo 1111, \twobytwo 11{-1}{-1}, \twobytwo 1{-1}1{-1}, \twobytwo 1{-1}{-1}1$$
or
$$\twobytwo 1001, \twobytwo 0110, \twobytwo 100{-1}, \twobytwo
01{-1}0$$ If you have trouble checking that the matrices in your basis
are independent, think of them as vectors in $\R^4$ and check that
those vectors are independent. The examples above are easy to check
because, when considered as vectors in $\R^4$, they are orthogonal.

Of these bases, the first may be best for describing diagonal matrices; the third is also reasonably good for that task:
$$\twobytwo 4002 = 3\twobytwo 1001 + 1 \twobytwo 100{-1}.$$

The first basis also looks best for describing triangular matrices -- any triangular matrix is a combination of only three of the four vectors.  The third is best for describing symmetric matrices because symmetric matrices will always have a zero coefficient for the $\small \twobytwo 01{-1}0$ component. 
}

\end{document}
