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

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

\newif\ifLF 
\LFfalse

\ovingnr{02}
\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 1.3 - Matrix operations}

{\bf Exercise \exnum} Exercise 1a, 1c, 1d, and 1f in chapter 1.3 of Elementary Linear Algebra.

\ifLF{
  1a is not defined since $A$ has 5 columns, while $B$ has only 4 rows.

  1c is $4\times 2$, 1d is $5\times 2$ and 1f is $5\times 5$.
}\fi

{\bf Exercise \exnum} Exercise 5a and 5b in chapter 1.3 of Elementary Linear Algebra.

\ifLF{
  \begin{align*}
    AB=\begin{bmatrix}
      12 & -3\\
-4&  5\\
 4&  1
    \end{bmatrix}
  \end{align*}
  $BA$ is not defined since $B$ has 2 columns while $A$ has three rows.
}\fi

\subsection*{Chapter 1.4 - Inverses}

{\bf Exercise \exnum} Exercise 10 in chapter 1.4 of Elementary Linear Algebra.

\ifLF{
  We set up the augmented matrix and rowreduce
  \begin{align*}
    \begin{bmatrix}
      \cos\theta & \sin\theta & 1 & 0\\
      -\sin\theta & \cos\theta & 0 & 1
    \end{bmatrix}
    &\sim 
    \begin{bmatrix}
      \cos^2\theta & \sin\theta\cos\theta & \cos\theta & 0\\
      -\sin^2\theta & \sin\theta\cos\theta & 0 & \sin\theta
    \end{bmatrix}
    \sim\\ 
    \begin{bmatrix}
      \cos^2\theta + \sin^2\theta & 0 & \cos\theta & -\sin\theta\\
      -\sin^2\theta & \sin\theta\cos\theta & 0 & \sin\theta
    \end{bmatrix}
    &=
    \begin{bmatrix}
      1 & 0 & \cos\theta & -\sin\theta\\
      -\sin^2\theta & \sin\theta\cos\theta & 0 & \sin\theta
    \end{bmatrix}
    \sim\\ 
    \begin{bmatrix}
      1 & 0 & \cos\theta & -\sin\theta\\
      0 & \sin\theta\cos\theta & \sin^2\theta\cos\theta & \sin\theta - \sin^3\theta
    \end{bmatrix}
    &=
    \begin{bmatrix}
      1 & 0 & \cos\theta & -\sin\theta\\
      0 & \sin\theta\cos\theta & \sin^2\theta\cos\theta & \sin\theta(1-\sin^2\theta)
    \end{bmatrix}
    =\\
    \begin{bmatrix}
      1 & 0 & \cos\theta & -\sin\theta\\
      0 & \sin\theta\cos\theta & \sin^2\theta\cos\theta & \sin\theta\cos^2\theta
    \end{bmatrix}
    &\sim 
    \begin{bmatrix}
      1 & 0 & \cos\theta & -\sin\theta\\
      0 & 1 & \sin\theta & \cos\theta
    \end{bmatrix}
  \end{align*}
  So the inverse is 
  \begin{align*}
    \begin{bmatrix}
      \cos\theta & -\sin\theta\\
      \sin\theta & \cos\theta
    \end{bmatrix}
    =
    \begin{bmatrix}
      \cos(-\theta) & \sin(-\theta)\\
      -\sin(-\theta) & \cos(-\theta)
    \end{bmatrix}
  \end{align*}
}\fi

{\bf Exercise \exnum} Exercise 29 in chapter 1.4 of Elementary Linear Algebra.

\ifLF{
  \begin{align*}
    A^2 - 9I = (A+3I)(A-3I) =
    \begin{bmatrix}
      2 & 4\\
      8 & -6
    \end{bmatrix}
  \end{align*}
}\fi

{\bf Exercise \exnum} Exercise 45a and 45b in chapter 1.4 of Elementary Linear Algebra.

\ifLF{
  \begin{itemize}
    \item[45a] 
    \begin{align*}
      A(A^{-1} + B^{-1})B(A+B)^{-1} &= (AA^{-1} + AB^{-1})B(A+B)^{-1}\\
      &= (I + AB^{-1})B(A+B)^{-1}\\
      &= B(A+B)^{-1} + AB^{-1}B(A+B)^{-1}\\
      &= B(A+B)^{-1} + A(A+B)^{-1}\\
      &= (B+A)(A+B)^{-1}\\
      &= (A+B)(A+B)^{-1}\\
      &= I\\
    \end{align*}
    \item[45b] If we multiply the equation by $A^{-1}$ on the left and $A$ on the right we get
    \begin{align*}
      A^{-1}A(A^{-1} + B^{-1})B(A+B)^{-1}A &= A^{-1}A = =\\
      (A^{-1} + B^{-1})B(A+B)^{-1}A &= I
    \end{align*}
    Thus $(A^{-1} + B^{-1})$ is invertible with inverse $B(A+B)^{-1}A$.
  \end{itemize}
}\fi

{\bf Exercise \exnum} Exercise 46a in chapter 1.4 of Elementary Linear Algebra.

\ifLF{
  \begin{align*}
    (I-A)^2 = (I-A)(I-A) = I^2 - AI - IA + A^2 = I - 2A + A = I-A
  \end{align*}
}\fi

\end{document}

