\documentclass[11pt, a4paper, english]{NTNUoving}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{siunitx}
\usepackage{pgfplots}
\usepackage{blkarray, enumitem, amsthm}
%\pgfplotsset{compat=1.9}
\usepackage{tikz}
\usetikzlibrary{automata,arrows,positioning,calc, tikzmark}
\pgfplotsset{compat=1.17}


\newcounter{exercisenumber}
\newcommand\exnum{\stepcounter{exercisenumber}\theexercisenumber}

\newif\ifLF 
\LFfalse

\ovingnr{08}
\semester{}
\fag{MA1201 Linear Algebra and Geometry }
\institutt{Department of Mathematical Sciences }
\def\centerfoot{}
\begin{document}

\section*{Compulsory exercises}
Hand in your solutions to these exercises. All answers must be justified.

\subsection*{Chapter 4.5 - Coordinates}
{\bf Exercise \exnum} Do exercise 11 in chapter 4.5 of Elementary Linear Algebra.

\ifLF{
  \begin{enumerate}[label=(\alph*)]
    \item We set up the augmented matrix and rowreduce:
    \begin{align*}
      \begin{bmatrix}
        2 & 3 & 1\\
        -4 & 8 & 1
      \end{bmatrix}
      \sim 
      \begin{bmatrix}
        1 & 0 & \frac{5}{28}\\
        0 & 1 & \frac3{14}
      \end{bmatrix}
    \end{align*}
    So $[\mathbf w]_{S} = \begin{bmatrix}
      \frac5{28}\\ \frac{3}{14}
    \end{bmatrix}$.
    \item We set up the augmented matrix and rowreduce:
    \begin{align*}
      \begin{bmatrix}
        1 & 0 & a\\
        1 & 2 & b
      \end{bmatrix}
      \sim 
      \begin{bmatrix}
        1 & 0 & a\\
        0 & 1 & \frac{b-a}2
      \end{bmatrix}
    \end{align*}
    So $[\mathbf w]_{S} = \begin{bmatrix}
      a\\ \frac{b-a}2
    \end{bmatrix}$.
  \end{enumerate}
}\fi

{\bf Exercise \exnum} Do exercise 13a in chapter 4.5 of Elementary Linear Algebra.

\ifLF{
  We set up the augmented matrix and rowreduce:
  \begin{align*}
    \begin{bmatrix}
      1 & 2 & 3 & 2\\
      0 & 2 & 3 & -1\\
      0 & 0 & 3 & 3
    \end{bmatrix}
    \sim 
    \begin{bmatrix}
      1 & 0 & 0 & 3\\
      0 & 1 & 0 & -2\\
      0 & 0 & 1 & 1
    \end{bmatrix}\\
    [\mathbf v]_{S} = \begin{bmatrix}
     3\\
     -2\\
      1
    \end{bmatrix}\\
  \end{align*}
}\fi

\subsection*{Chapter 4.6 - Dimension}
{\bf Exercise \exnum} Do exercise 7 in chapter 4.6 of Elementary Linear Algebra.

\ifLF{
  \begin{enumerate}[label=(\alph*)]
    \item $3x-2y+5z=0$ has solutions $x = \frac23y - \frac53z$, which in vectorform we can write as 
    \begin{align*}
      \begin{bmatrix}
        \frac23y - \frac53z\\
        y\\
        z
      \end{bmatrix} =
      y\begin{bmatrix}
        \frac23 \\ 1 \\0
      \end{bmatrix}+
      z\begin{bmatrix}
        -\frac53\\0\\1
      \end{bmatrix}
    \end{align*}
    Therefore the space is 2-dimensional with a basis given by 
    \begin{align*}
      \left\lbrace
      \begin{bmatrix}
        \frac23 \\ 1 \\0
      \end{bmatrix}
      ,\begin{bmatrix}
        -\frac53\\0\\1
      \end{bmatrix}
      \right\rbrace
    \end{align*}
    \item $x-y=0$ has solutions $x = y$, which in vectorform we can write as 
    \begin{align*}
      \begin{bmatrix}
        y\\
        y\\
        z
      \end{bmatrix} =
      y\begin{bmatrix}
        1 \\ 1 \\0
      \end{bmatrix}+
      z\begin{bmatrix}
        0\\0\\1
      \end{bmatrix}
    \end{align*}
    Therefore the space is 2-dimensional with a basis given by 
    \begin{align*}
      \left\lbrace
      \begin{bmatrix}
        1 \\ 1 \\0
      \end{bmatrix}
      ,\begin{bmatrix}
        0\\0\\1
      \end{bmatrix}
      \right\rbrace
    \end{align*}
    \item The line is described as all vectors on the form 
    \begin{align*}
      \begin{bmatrix}
        2t\\-t\\4t
      \end{bmatrix} = 
      t\begin{bmatrix}
        2\\-1\\4
      \end{bmatrix}
    \end{align*}
    Therefore the space is 1-dimensional with a basis given by 
    \begin{align*}
      \left\lbrace
      \begin{bmatrix}
        2 \\ -1 \\4
      \end{bmatrix}
      \right\rbrace
    \end{align*}
    \item The vectors can be written as 
    \begin{align*}
      \begin{bmatrix}
        a \\ a+c\\c
      \end{bmatrix} =
      a\begin{bmatrix}
        1\\1\\0
      \end{bmatrix}+
      c\begin{bmatrix}
        0\\1\\1
      \end{bmatrix}
    \end{align*}
    Therefore the space is 2-dimensional with a basis given by 
    \begin{align*}
      \left\lbrace
      \begin{bmatrix}
        1 \\ 1 \\0
      \end{bmatrix}
      ,\begin{bmatrix}
        0\\1\\1
      \end{bmatrix}
      \right\rbrace
    \end{align*}
  \end{enumerate}
}\fi

{\bf Exercise \exnum} Do exercise 9 in chapter 4.6 of Elementary Linear Algebra (You may assume $n=3$ if you prefer).

\ifLF{
  \begin{enumerate}
    \item Let $E_{ij}$ be the $n\times n$-matrix which is 1 in coordinate $(i,j)$ and 0 elsewhere. Then a basis for the diagonal matrices is $\{E_{ii}\}_{i=1}^n$, thus the space is $n$-dimensional.
    \item A basis for the symmetric matrices is $\{E_{ij}+E_{ji}\}_{j \geq i}$ so the space is $\frac{n^2 + n}{2}$-dimensional.
    \item A basis for the upper triangular matrices is $\{E_{ij}\}_{j \geq i}$ so the space is $\frac{n^2 + n}{2}$-dimensional.
  \end{enumerate}
}\fi

\subsection*{Chapter 4.7 - Change of basis}
{\bf Exercise \exnum} Do exercise 1 in chapter 4.7 of Elementary Linear Algebra.

\ifLF{
  \begin{enumerate}[label=(\alph*)]
    \item We set up the augmented matrix and reduc:
    \begin{align*}
      \begin{bmatrix}
        2 & 4 & 1 & -1\\
        2 & -1 & 3 & -1
      \end{bmatrix}
      \sim 
      \begin{bmatrix}
        1 & 0 & \frac{13}{10} & \frac{-1}{2}\\
        0 & 1 & \frac{-2}{5} & 0
      \end{bmatrix}
    \end{align*}
    So the transition matrix from $B'$ to $B$ is 
    \begin{align*}
      \begin{bmatrix}
        \frac{13}{10} & \frac{-1}{2}\\
        \frac{-2}{5} & 0
      \end{bmatrix}
    \end{align*}
    \item The transition matrix from $B$ to $B'$ will be the inverse of the one we just computed, thus equal to 
    \begin{align}
      \frac{1}{-1/5} \begin{bmatrix}
        0 & \frac12\\
        \frac25 & \frac{13}{10}
      \end{bmatrix} = 
      \begin{bmatrix}
        0 & \frac{-5}{2}\\
        -2 & \frac{-13}{2}
      \end{bmatrix}
    \end{align}
    \item We set up the augmented matrix and reduce:
    \begin{align*}
      \begin{bmatrix}
        2 & 4 & 3\\
        2 & -1 & -5
      \end{bmatrix}
      \sim 
      \begin{bmatrix}
        1 & 0 & -\frac{17}{10}\\
        0 & 1 & \frac{8}{5}
      \end{bmatrix}\\
      [\mathbf w]_{B} = \begin{bmatrix}
        -\frac{17}{10}\\ \frac85
      \end{bmatrix}
    \end{align*}  
    To compute $[\mathbf w]_{B'}$ we multply by the transition matrix 
    \begin{align*}
      [\mathbf w]_{B'} =
      \begin{bmatrix}
        0 & -\frac52\\
        -2 & -\frac{13}2
      \end{bmatrix}
      \begin{bmatrix}
        -\frac{17}{10}\\ \frac85  
      \end{bmatrix}
      =
      \begin{bmatrix}
        -4\\ -7
      \end{bmatrix}
    \end{align*}
    \item We can compute $[\mathbf w]_{B'}$ directly by setting up the augmented matrix and reducing:
    \begin{align*}
      \begin{bmatrix}
        1 & -1 & 3\\
        3 & -1 & -5
      \end{bmatrix}
      \sim
      \begin{bmatrix}
        1 & 0 & -4\\
        0 & 1 & -7
      \end{bmatrix}
    \end{align*}
    Which verifies that our answer was correct.
  \end{enumerate}
}\fi

{\bf Exercise \exnum} Do exercise 5 in chapter 4.7 of Elementary Linear Algebra.

\ifLF{
  \begin{enumerate}[label=(\alph*)]
    \item For something to be a basis it must span $V$ and be linearly independent. We first show linear independence:
    
    Assume $a\mathbf g_1 + b\mathbf g_2 = 0$. That means $2a\sin x + a\cos x + 3b\cos x = 0$. If we set $x= \frac{\pi}{2}$ then we get $2a = 0$, which means $a = 0$. Then if we set $x=0$ we get $3b = 0$ which means $b=0$. So $a=b=0$ is the only solution, and they are linearly independent.

    Since they are two linearly independence vectors, their span is 2-dimensional. And since $V$ is spanned by 2 vectors it must be at most 2-dimensional. Thus $\mathbf g_1$ and $\mathbf g_2$ span all of $V$.

    Since they are linearly independent and span $V$, they form a basis.
    \item The transition matrix has columns given by the coordinate vectors
    \begin{align*}
      P_{B' \to B} =
      \begin{bmatrix}
        [\mathbf g_1]_{B} [\mathbf g_2]_{B}  
      \end{bmatrix} = 
      \begin{bmatrix}
        2 & 0\\
        1 & 3
      \end{bmatrix}
    \end{align*}
    \item \begin{align*}
      P_{B\to B'} = P_{B'\to B}^{-1} = \begin{bmatrix}
        \frac12 & 0\\
        -\frac16 & \frac13
      \end{bmatrix}
    \end{align*}
    \item 
    \begin{align*}
      [\mathbf h]_B = \begin{bmatrix}
        2\\-5
      \end{bmatrix},
      \quad\quad
      [\mathbf h]_{B'} = P_{B\to B'}[\mathbf h]_B = \begin{bmatrix}
        1\\-2
      \end{bmatrix}
    \end{align*}
    \item We want to solve $\mathbf h = a\mathbf g_1 + b\mathbf g_2$. We can set up this as a system of equations and rowreduce:
    \begin{align*}
      \begin{bmatrix}
        2 & 0 & 2\\
        1 & 3 & -5
      \end{bmatrix}
      \sim 
      \begin{bmatrix}
        1 & 0 & 1\\
        0 & 1 & -2
      \end{bmatrix}
    \end{align*}
    This verifies that our answer is correct.
  \end{enumerate}
}\fi



\end{document}

