\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{10}
\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 5.1 - Eigenvalues and eigenvectors}
{\bf Exercise \exnum} Do exercise 1 in chapter 5.1 of Elementary Linear Algebra.

\ifLF{
  \begin{align*}
    A\mathbf x =
    \begin{bmatrix}
      1 & 2 \\ 3 & 2
    \end{bmatrix}
    \begin{bmatrix}
      1 \\-1
    \end{bmatrix} =
    \begin{bmatrix}
      -1 \\ 1
    \end{bmatrix} = (-1)\begin{bmatrix}
      1 \\-1
    \end{bmatrix}
  \end{align*}
  So $\mathbf x$ is an eigenvector with eigenvalue -1.
}\fi

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

\ifLF{
  The charcteristic equation is $\det(\lambda I - A)=0$, which gives us $\lambda^2 - 4\lambda - 5=0$. The solutions to this equation are $\lambda = -1$ and $\lambda = 5$, so the eigenvalues of $A$ are -1 and 5. To find the bases for the eigenspaces we rowreduce $\lambda I -A$:
  \begin{align*}
    \lambda =-1 \colon \quad \begin{bmatrix}
      -2 & -4\\
      -2 & -4
    \end{bmatrix}
    \sim
    \begin{bmatrix}
      1 & 2\\0&0
    \end{bmatrix}
  \end{align*} 
  So the eigenspace associated to -1 consists of all vectors where $x_1 +2x_2 = 0$ and $x_2$ is free. A bais is given by $\left\lbrace \begin{bmatrix}
    -2\\1
  \end{bmatrix} \right\rbrace$.

  We do a similar calculation for $\lambda = 5$:
  \begin{align*}
    \lambda =5 \colon \quad \begin{bmatrix}
      4 & -4\\
      -2 & 2
    \end{bmatrix}
    \sim
    \begin{bmatrix}
      1 & -1\\0&0
    \end{bmatrix}
  \end{align*} 
  Which gives us basis $\left\lbrace \begin{bmatrix}
    1\\1
  \end{bmatrix}\right\rbrace$.
}\fi

{\bf Exercise \exnum} Do exercise 25 in chapter 5.1 of Elementary Linear Algebra.

\ifLF{
  \begin{enumerate}[label=(\alph*)]
    \item Since the characteristic polynomial has degree $1+2+3=6$, the matrix is $6\times 6$.
    \item Since $0$ is not a root of the characteristic polynomial, $A$ does not have $0$ as an eigenvalue. That means that the nullspace $N(A)$ is $\{\mathbf 0\}$, which for a square matrix is equivalent to being invertible. So $A$ is invertible.
    \item A matrix has one eigenspace for each eigenvalue. From the characteristic polynomial we see that we have 3 eigenvalues, and thus 3 eigenspaces.
  \end{enumerate}
}\fi

{\bf Exercise \exnum} Do exercise 33 in chapter 5.1 of Elementary Linear Algebra.

\ifLF{
  We have that $\mathbf x$ is an eigenvector with eigenvalue $\lambda$. That means that $A\mathbf x = \lambda \mathbf x$. If we multiply both sides by $A^{-1}$ we get:
  \begin{align*}
    A^{-1}A\mathbf x &= A^{-1}\lambda \mathbf x\\
    \mathbf x &=  A^{-1}\lambda\mathbf x\\
    \mathbf x &= \lambda A^{-1}\mathbf x\\
    \frac{1}{\lambda}\mathbf x &= A^{-1}\mathbf x
  \end{align*}
  This is exactly the statement that $\mathbf x$ is an eigenvector of $A^{-1}$ with eigenvalue $1/\lambda$, which is what we wanted to prove. \qed
}\fi

\subsection*{Chapter 5.2 - Diagonalization}

{\bf Exercise \exnum} Let $A$ be the matrix in exercise 5a in chapter 5.1, considered earlier in this exercise set. Diagonalize $A$, i.e. find an invertible matrix $P$ and a diagonal matrix $D$ such that $A=PDP^{-1}$. Verify your solution by checking that $AP=PD$.

\ifLF{
  Earlier we found the eigenvalues of $A$ to be $-1$ and $5$ and we found corresponding basisvectors $\begin{bmatrix}
    -2\\1
  \end{bmatrix}$ and $\begin{bmatrix}
    1\\1
  \end{bmatrix}$. This gives us that
  \begin{align*}
    P = \begin{bmatrix}
      -2 & 1\\
      1 & 1
    \end{bmatrix},
    \quad
    D=
    \begin{bmatrix}
      -1 & 0\\
      0 & 5
    \end{bmatrix}
  \end{align*}
  We verify this by computing $AP$ and $PD$:
  \begin{align*}
    AP = \begin{bmatrix}
      2 & 5\\
      -1 & 5
    \end{bmatrix} = PD
  \end{align*}
}\fi

{\bf Exercise \exnum} In example 6 on page 307 it is shown that if $A=PDP^{-1}$ then $A^k = PD^k P^{-1}$. Use this to compute $A^5$, where $A$ is the matrix from the previous exercise.

\ifLF{
  So $A^5 = PD^5 P^{-1}$. We first compute $P^{-1}$ to be 
  \begin{align*}
    P^{-1} = \begin{bmatrix}
      -\frac13 & \frac13\\
      \frac13 & \frac23
    \end{bmatrix}
  \end{align*}
  Then we can compute $A^5$ as 
  \begin{align*}
    A^5 = PD^5P^{-1} &= \begin{bmatrix}
      -2 & 1\\
      1 & 1
    \end{bmatrix}
    \begin{bmatrix}
      (-1)^5 & 0\\
      0 & 5^5
    \end{bmatrix}
    \begin{bmatrix}
      -\frac13 & \frac13\\
      \frac13 & \frac23
    \end{bmatrix}\\
    &=
    \begin{bmatrix}
      -2 & 1\\
      1 & 1
    \end{bmatrix}
    \begin{bmatrix}
      -1 & 0\\
      0 & 3125
    \end{bmatrix}
    \begin{bmatrix}
      -\frac13 & \frac13\\
      \frac13 & \frac23
    \end{bmatrix}\\
    &=
    \begin{bmatrix}
      2 & 3125\\
      -1 & 3125
    \end{bmatrix}
    \begin{bmatrix}
      -\frac13 & \frac13\\
      \frac13 & \frac23
    \end{bmatrix}\\
    &= \begin{bmatrix}
      1041 & 2084\\
      1042 & 2083
    \end{bmatrix}
  \end{align*}
}\fi

{\bf Exercise \exnum} Do exercise 10 in chapter 5.2 of Elementary Linear Algebra.

\ifLF{
  \begin{enumerate}[label=(\alph*)]
    \item The characteristic polynomial of $A$ is $\det(\lambda I - A) = (\lambda-3)(\lambda -2)^2$. So the eigenvalues are 3 and 2.
    \item For $\lambda =3$ we have that 
    \begin{align*}
      3 I - A = \begin{bmatrix}
        0 & 0 & 0\\
        0 & 1 & 0\\
        0 & -1 & 1
      \end{bmatrix}
      \sim
      \begin{bmatrix}
        0 & 0 & 0\\
        0 & 1 & 0\\
        0 & 0 & 1
      \end{bmatrix}
    \end{align*}
    So $3I-A$ has rank 2.

    For $\lambda = 2$ we have 
    \begin{align*}
      2 I - A = \begin{bmatrix}
        -1 & 0 & 0\\
        0 & 0 & 0\\
        0 & -1 & 0
      \end{bmatrix}
      \sim
      \begin{bmatrix}
        1 & 0 & 0\\
        0 & 1 & 0\\
        0 & 0 & 0
      \end{bmatrix}
    \end{align*}
    So $2I-A$ also has rank 2.
    \item For $A$ to be diagonalizable we need to find 3 linearly independent eigenvectors. We saw that $\lambda I - A$ has rank 2. Using the Rank-Nullity theorem this means that the null space of $\lambda I-A$ is $3-2=1$-dimensional. The null space of $\lambda I-A$ is exactly the eigenspace of $\lambda$, so we have two 1-dimensional eigenspaces. Therefore we can have at most 2 linearly independent eigenvectors, and $A$ is not diagonalizable.
  \end{enumerate}
}\fi


\end{document}

