What is the rank of the matrix A?
\[ A = \left[ {\begin{array}{cc} 1 & 2 & 3 & 4\\ -1 & 0 & 1 & 3\\ 0 & 1 & -2 & 1\\ 5 & 4 & -2 & -3\\ \end{array}} \right] \]
A <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3),nrow = 4,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
Rank:
library(Matrix)
library(pracma)
##
## Attaching package: 'pracma'
## The following objects are masked from 'package:Matrix':
##
## expm, lu, tril, triu
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
rankMatrix(A)[1]
## [1] 4
Rank(A) = 4
assuming m rows and n columns then the maximum rank would be the minimum between m or n. (ie 4x5 matrix -> 4 5x2 matrix -> 2)
The minimum rank would be 1 for a non-zero matrix
\[ B = \left[ {\begin{array}{cc} 1 & 2 & 1\\ 3 & 6 & 3\\ 2 & 4 & 2\\ \end{array}} \right] \]
B <- matrix(c(1,3,2,2,6,4,1,3,2),nrow = 3,ncol=3)
B
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 3 6 3
## [3,] 2 4 2
rref(B)
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 0 0 0
## [3,] 0 0 0
rankMatrix(B)[1]
## [1] 1
We can see 1 non-zero row in the reduced row echelon form of matrix B thus the rank is 1.
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 = \left[ {\begin{array}{cc} 1 & 2 & 3\\ 0 & 4 & 5\\ 0 & 0 & 6\\ \end{array}} \right] \]
A <- matrix(c(1,0,0,2,4,0,3,5,6),nrow = 3,ncol=3)
A
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 4 5
## [3,] 0 0 6
eigen(A)$values
## [1] 6 4 1
eigen(A)$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