\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}



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

\newif\ifLF 
\LFfalse

\ovingnr{05}
\semester{}
\fag{MA1201 Linear Algebra and Geometry }
\institutt{Department of Mathematical Sciences }
\def\centerfoot{}
\begin{document}
%\textbf{Due by 30 August 2020} 
%
%{\large \bf Kom-i-gang-oppgaver} 
%

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

\subsection*{Chapter 2.1 - determinants and cofactors}

{\bf Exercise \exnum} Let $A = \begin{bmatrix}
  1 & 0 & -1\\
  1 & 1 & 0\\
  0 & 0 & 1
\end{bmatrix}$. Find $A_{12}$, the cofactor at index $(1,2)$.

\ifLF{
  To find the cofactor we first remove the first row and second column.
  \begin{align*}
    \begin{bmatrix}
      \tikzmarknode{A11}{1} & \tikzmarknode{A12}{0} & \tikzmarknode{A13}{-1}\\
      1 & 1 & 0\\
      0 & \tikzmarknode{A32}{0} & 1
    \end{bmatrix}
    \rightarrow
    \begin{bmatrix}
      1 & 0\\ 0 & 1
    \end{bmatrix}
  \end{align*}
  \tikz[overlay,remember picture] {
    \draw[-,red,thick] (A11.west) -- (A13.east);
    \draw[-,red,thick] (A12.north) -- (A32.south)
  }
  Then the cofactor is given by $(-1)^{1+1} \cdot (-1)^{2+1} \cdot \det\left( \begin{bmatrix}
    1&0\\0&1
  \end{bmatrix} \right) = -1$
}\fi

{\bf Exercise \exnum} Exercise 15 in chapter 2.1 of Elementary Linear Algebra.

\ifLF{
  \begin{align*}
    \det\left( \begin{bmatrix}
      \lambda -2 & 1\\ -5 & \lambda + 4
    \end{bmatrix} \right)&=
    (\lambda-2)(\lambda+4) + 5 \\&=
    \lambda^2 + 2\lambda -3 \\&= (\lambda -1)(\lambda +3)
  \end{align*}
  This is $0$ when $\lambda = 1$ or $\lambda = -3$.
}\fi

{\bf Exercise \exnum} Exercise 21 in chapter 2.1 of Elementary Linear Algebra.

\ifLF{
  If we choose the middle column then the expansion becomes
  \begin{align*}
    \det\left(\begin{bmatrix}
      -3 & 0 & 7\\
      2  5 & 1\\
      -1 & 0 & 5
    \end{bmatrix}\right) =
    5 \cdot ((-3)\cdot 5 - 7\cdot(-1)) = -40
  \end{align*}
}\fi

{\bf Exercise \exnum} Exercise 30 in chapter 2.1 of Elementary Linear Algebra.

\ifLF{
  The determinant of a triangular matrix is the product of teh diagonal elements, so
  \begin{align*}
    \det\left(\begin{bmatrix}
      1 & 1 & 1 & 1\\
      0 & 2 & 2 & 2\\
      0 & 0 & 3 & 3\\
      0 & 0 & 0 & 4
    \end{bmatrix}\right) =
    1\cdot 2 \cdot 3 \cdot 4 = 24
  \end{align*}
}\fi

\subsection*{Chapter 2.2 - determinants and row reduction}

{\bf Exercise \exnum} Exercise 9 in chapter 2.2 of Elementary Linear Algebra.

\ifLF{
  We row reduce the matrix keeping track of what type of row operations we perform.
  \begin{align*}
    \begin{bmatrix}
      3 & -6 & 9\\
      -2 & 7 & -2\\
      0 & 1 & 5
    \end{bmatrix}
    \sim 
    \begin{bmatrix}
      1 & -2 & 3\\
      -2 & 7 & -2\\
      0 & 1 & 5
    \end{bmatrix}
    \sim 
    \begin{bmatrix}
      1 & -2 & 3\\
      0 & 3 & 4\\
      0 & 1 & 5
    \end{bmatrix}
    \sim 
    \begin{bmatrix}
      1 & -2 & 3\\
      0 & 0 & -11\\
      0 & 1 & 5
    \end{bmatrix}
    \sim 
    \begin{bmatrix}
      1 & -2 & 3\\
      0 & 1 & 5\\
      0 & 0 & -11
    \end{bmatrix}
  \end{align*}
  The determinant of the reduced matrix is $1\cdot 1\cdot (-11)=-11$. The operations we have done that change the determiant is to divide one row by 3, and to swap two rows. Thus the determinant of the original matrix is $(-11)\cdot 3 \cdot (-1) = 33$.
}\fi

{\bf Exercise \exnum} Exercise 15 in chapter 2.2 of Elementary Linear Algebra.

\ifLF{
  We can obtain this matrix from the original by first swapping the first and second row, then swapping the second and third row. Thus the determiannt has changed by a factor of $(-1)\cdot (-1)$, meaning it hasn't changed at all. The determinant is $-6$.
}\fi

{\bf Exercise \exnum} Exercise 22 in chapter 2.2 of Elementary Linear Algebra.

\ifLF{
  If we take 2 times the first row and add it to the third row we see that we get a row of all zeros. Thus the determinant is 0.
}\fi

\subsection*{Chapter 2.3 - Cramer's rule}
{\bf Exercise \exnum} Calculate the determinant of 
\begin{align*}
  \begin{bmatrix}
    1 & 0 & 1\\
    0 & 1 & 0\\
    1 & 0 & -1
  \end{bmatrix}
\end{align*}

\ifLF{
  The determiannt is $-2$.
}\fi

{\bf Exercise \exnum} Find the adjoint of the matrix above. What's the inverse?

\ifLF{
  The cofactor matrix is 
  \begin{align*}
    \begin{bmatrix}
      -1 & 0 & -1\\
      0 & -2 & 0\\
      -1 & 0 & 1
    \end{bmatrix}
  \end{align*}
  To find the adjoint we take the transpose of this which gives us the same thing. The inverse is given by 
  \begin{align*}
    A^{-1} = \frac{1}{\det(A)}\operatorname{adj}(A) = \begin{bmatrix}
      frac12 & 0 & \frac12\\
      0 & 1 & 0\\
      \frac12 & 0 & -\frac12
    \end{bmatrix}
  \end{align*}
}\fi

\end{document}

