library(pracma)

Problem set 1

1. What is the rank of the matrix A?

A <- matrix(c(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3), byrow = T, ncol = 4)
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
rref(A)
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    0
## [2,]    0    1    0    0
## [3,]    0    0    1    0
## [4,]    0    0    0    1
Rank(A)
## [1] 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?

The max rank cannot be greater than ‘n’. The min rank in this case (non-zero) is 1.

(3) What is the rank of matrix B?

B <- matrix(c(1,2,1,3,6,3,2,4,2), byrow = T, ncol = 3)
B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
Rank(B)
## [1] 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 <- matrix(c(1,2,3,0,4,5,0,0,6), byrow = T, ncol = 3)
A
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    4    5
## [3,]    0    0    6
eigen(A)
## eigen() decomposition
## $values
## [1] 6 4 1
## 
## $vectors
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0
charpoly(A)
## [1]   1 -11  34 -24

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

\[\lambda I_{3} =\begin{bmatrix}\lambda & 0 & 0 \\0 & \lambda & 0 \\0 & 0 & \lambda\end{bmatrix}\]

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

\((\lambda - 1) (\lambda - 4) (\lambda - 6) + (-2 \times -5 \times 0) + (3 \times 0 \times 0) -\) \((-2 \times 0 \times (\lambda - 6)) - ((\lambda - 1) \times - 5 \times - 0) - (-3 \times (\lambda - 4) \times 0) = 0\)

The eigenvalues are: \(= (\lambda - 1) (\lambda - 4) (\lambda - 6) = 0\)