\(~\)

# Install packages if needed and load library
#install.packages("Matrix")
library(Matrix)

\(~\)

Problem Set 1

(1) What is the rank of the matrix A?

\[A = \begin{bmatrix}1 & 2 & 3 & 4\\ -1 & 0 & 1 & 3\\ 0 & 1 & -2 & 1\\ 5 & 4 & -2 & -3 \end{bmatrix}\]

# Create matrix A
A <- matrix(c(1, 2, 3, 4, -1, 0, 1, 3, 0, 1, -2, 1, 5, 4, -2, -3), nrow = 4, byrow = TRUE)
A
##      [,1] [,2] [,3] [,4]
## [1,]    1    2    3    4
## [2,]   -1    0    1    3
## [3,]    0    1   -2    1
## [4,]    5    4   -2   -3
# Rank of the matrix A
qr(A)$rank
## [1] 4

Solution: Given the matrix the rank is 4.

\(~\)

(2) Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

Assuming that the matrix is a non-zero, the maximum and minimum rank is no greater than the smallest row or column dimension, in this case being n.

\(~\)

(3) What is the rank of matrix B? \[B = \begin{bmatrix}1 & 2 & 1\\ 3 & 6 & 3\\ 2 & 4 & 2 \end{bmatrix}\]

# Create matrix B
B <- matrix(c(1, 2, 1, 3, 6, 3, 2, 4, 2), nrow = 3, byrow = TRUE)
qr(B)$rank
## [1] 1

Solution: The rank for matrix B is 1.

\(~\)

Problem Set 2

Compute the eigenvalues and eigenvectors of the matrix A. You’ll need to show your work. You’ll need to write out the characteristic polynomial and show your solution.

\[A = \begin{bmatrix}1 & 2 & 3\\ 0 & 4 & 5\\ 0 & 0 & 6 \end{bmatrix}\]

\(~\)

# Create matrix A
A_ps2 <- matrix(c(1, 2, 3, 0, 4, 5, 0, 0, 6), nrow = 3, byrow = T)

# Find Eigenvalues
eigen(A_ps2)$values
## [1] 6 4 1
# Find Eigenvectors
eigen(A_ps2)$vectors
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0

\(~\)

Identity Matrix

Av = \(\lambda\)v

\(~\)

Av = \(\lambda\)Iv

\(~\)

|A-\(\lambda\)I| = 0

\(~\)

Solving for \(\lambda\)

\[\begin{vmatrix}1 & 2 & 3\\ 0 & 4 & 5\\ 0 & 0 & 6 \end{vmatrix} -\lambda \begin{vmatrix}1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{vmatrix}=0\]

Which is:

\[ \begin{vmatrix}(1-\lambda) & 2 & 3\\ 0 & (4-\lambda) & 5\\ 0 & 0 & (6-\lambda) \end{vmatrix}=0\]

\[(1-\lambda)\begin{vmatrix}(4-\lambda) & 5\\ 0 & (6-\lambda)\end{vmatrix} + 2 \begin{vmatrix}0 & 5\\ 0 & (6-\lambda)\end{vmatrix} + 3 \begin{vmatrix} 0 & (4-\lambda)\\ 0 & 0\end{vmatrix}\]

Equation:

  • (1 - \(\lambda\))[(4 - \(\lambda\))(6 - \(\lambda\)) - (0 * 0)] - 2[(0)(6 - \(\lambda\)) - (0 * 0)] + 3[(0 * 0) - (0 * 4 - \(\lambda\))]

  • (1 - \(\lambda\))[(4 - \(\lambda\))(6 - \(\lambda\)) = 0

  • (1 - \(\lambda\))(\(\lambda^{2}\) - 10\(\lambda\) +24) = 0

Characteristic polynomial:

  • \(\lambda^{3}\) - 11\(\lambda^{2}\) + 34\(\lambda\) - 24 = 0

Therefore, the Eigenvalues are:

  • \(\lambda_{1}\) = 1
  • \(\lambda_{2}\) = 4
  • \(\lambda_{3}\) = 6

The Eigenvectors are:

\[\lambda_{1} = 1 = \begin{bmatrix}1 \\ 0 \\ 0\end{bmatrix}\] \[\lambda_{2} = 4 = \begin{bmatrix}1 \\ \frac{3}{2} \\ 0\end{bmatrix}\] \[\lambda_{3} = 6 = \begin{bmatrix}\frac{8}{5} \\ \frac{5}{2} \\ 1\end{bmatrix}\]

\(~\)