---
title: Biostat 216 Homework 6
subtitle: 'Due Nov 26 @ 11:59pm'
format:
  html:
    theme: cosmo
    embed-resources: true
    number-sections: false
    toc: true
    toc-depth: 4
    toc-location: left
    code-fold: false
jupyter:
  jupytext:
    formats: 'ipynb,qmd'
    text_representation:
      extension: .qmd
      format_name: quarto
      format_version: '1.0'
      jupytext_version: 1.15.2
  kernelspec:
    display_name: Julia 1.10.5
    language: julia
    name: julia-1.10
---

Submit a PDF (scanned/photographed from handwritten solutions, or converted from RMarkdown or Jupyter Notebook) to Gracescope on BruinLearn.

## Linear equations, matrix inverses, orthogonal projection

### BV exercises

BV 11.5, 11.12, 11.18

### Q1 

Find the orthogonal projector into the plane spanned by the vectors $\begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}$ and $\begin{pmatrix} -2 \\ 2 \\ 1 \end{pmatrix}$.   

Find the orthogonal projection of the point $\mathbf{1}_3$ into the plane spanned by the vectors $\begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}$ and $\begin{pmatrix} -2 \\ 2 \\ 1 \end{pmatrix}$. 

### Q2

Matrices that satisfy $\mathbf{A}' \mathbf{A} = \mathbf{A} \mathbf{A}'$ are said to be _normal_. Give an example of asymmetric (not symmetric), normal matrix. If $\mathbf{A}$ is normal, then prove that every vector in $\mathcal{C}(\mathbf{A})$ is orthogonal to every vector in $\mathcal{N}(\mathbf{A})$. 

### Q3

Prove the following facts about triangular and orthogonal matrices.

1. The product of two upper (lower) triangular matrices is upper (lower) triangular.
    
2. The inverse of an upper (lower) triangular matrix is upper (lower) triangular.
    
3. The product of two unit upper (lower) triangular matrices is unit upper (lower) triangular.
    
4. The inverse of a unit upper (lower) triangular matrix is unit upper (lower) triangular.
    
5. An orthogonal upper (lower) triangular matrix is diagonal.

## Determinant

### Q4

Determinant.

1. Find the determinant of the following two matrices without doing any computations:
$$
\begin{pmatrix}
0 & 0 & 1\\
0 & 1 & 0 \\
1 & 0 & 0
\end{pmatrix}, \quad \begin{pmatrix}
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 \\
1 & 0 & 0 & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}.
$$  

2. Let $\mathbf{A} \in \mathbb{R}^{5 \times 5}$ with $\det(\mathbf{A}) = -3$. Find $\det(\mathbf{A}^3)$, $\det(\mathbf{A}^{-1})$, and $\det(2\mathbf{A})$.  
    
3. Find the determinant of the matrix
$\begin{pmatrix}
0 & 0 & 1 \\
2 & 3 & 4 \\
0 & 5 & 6
\end{pmatrix}$.

## Eigenvalues and eigenvectors

### Q5

Diagonalize (show the steps to find eigenvalues and eigenvectors)
$$
\mathbf{A} = \begin{pmatrix} 2 & -1 \\ -1 & 2 \end{pmatrix}
$$
and compute $\mathbf{X} \boldsymbol{\Lambda}^k \mathbf{X}^{-1}$ to prove the formula
$$
\mathbf{A}^k = \frac 12 \begin{pmatrix} 1 + 3^k & 1 - 3^k \\ 1 - 3^k & 1 + 3^k \end{pmatrix}.
$$

### Q6

Suppose the eigenvalues of a square matrix $\mathbf{A} \in \mathbb{R}^{n \times n}$ are $\lambda_1, \ldots, \lambda_n$. Show that $\det (\mathbf{A}) = \prod_{i=1}^n \lambda_i$. Hint: $\lambda_i$s are roots of the characteristic polynomial.

### Q7

Ture of false. For each statement, indicate it is true or false and gives a brief explanation.

1. If the columns of $\mathbf{X}$ (eigenvectors of a square matrix $\mathbf{A}$) are linearly independent, then (a) $\mathbf{A}$ is invertible; (b) $\mathbf{A}$ is diagonalizable; (c) $\mathbf{X}$ is invertible; (d) $\mathbf{X}$ is diagonalizable.
    
2. If the eigenvalues of $\mathbf{A}$ are 2, 2, 5 then the matrix is certainly (a) invertible; (b) diagonalizable. 
    
3. If the only eigenvectors of $\mathbf{A}$ are multiples of $\begin{pmatrix} 1 \\ 4 \end{pmatrix}$, then the matrix has (a) no inverse; (b) a repeated eigenvalue; (c) no diagonalization $\mathbf{X} \boldsymbol{\Lambda} \mathbf{X}^{-1}$. 

### Q8

Let $\mathbf{A} \in \mathbb{R}^{m \times n}$ and $\mathbf{B} \in \mathbb{R}^{n \times m}$. Show that $\mathbf{A} \mathbf{B}$ and $\mathbf{B} \mathbf{A}$ share the same non-zero eigenvalues. Hint: examine the eigen-equations.

### Q9

Let
$$
\mathbf{A} = \begin{pmatrix}
0 & 2 \\
1 & 1
\end{pmatrix}, \quad \mathbf{B} = \begin{pmatrix}
1 & 2 \\
0 & 1
\end{pmatrix}.
$$

1. Find eigenvalues and eigenvectors of $\mathbf{A}$ and $\mathbf{A}^{-1}$. Do they have same eigenvectors? What's the relationship between their eigenvalues?   

2. Find eigenvalues of $\mathbf{B}$ and $\mathbf{A} + \mathbf{B}$. Are eigenvalues of $\mathbf{A} + \mathbf{B}$ equal to eigenvalues of $\mathbf{A}$ plus eigenvalues of $\mathbf{B}$?   

3. Find eigenvalues of $\mathbf{A} \mathbf{B}$ and $\mathbf{B} \mathbf{A}$. Are the eigenvalues of $\mathbf{A} \mathbf{B}$ equal to eigenvalues of $\mathbf{A}$ times eigenvalues of $\mathbf{B}$? Are the eigenvalues of $\mathbf{A} \mathbf{B}$ equal to eigenvalues of $\mathbf{B} \mathbf{A}$?

### Q10

Suppose $\mathbf{A}$ has eigenvalues 0, 3, 5 with independent eigenvectors $\mathbf{u}$, $\mathbf{v}$, $\mathbf{w}$ respectively. 

1. Give a basis for $\mathcal{C}(\mathbf{A})$ and a basis for $\mathcal{N}(\mathbf{A})$.

2. Find a particular solution to $\mathbf{A} \mathbf{x} = \mathbf{v} + \mathbf{w}$. Find all solutions.  

3. Show that the linear equation $\mathbf{A} \mathbf{x} = \mathbf{u}$ has no solution. 
