library(Matrix)
library(pracma)
## Warning: package 'pracma' was built under R version 3.6.3
##
## Attaching package: 'pracma'
## The following objects are masked from 'package:Matrix':
##
## expm, lu, tril, triu
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
What is the rank of the matrix A?
rankMatrix(A)[1]
## [1] 4
Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?
The maximum rank is the minimum of the column and row rank. In this case the maxium column and row rank is equal to M and N. As N < M, we know the the maximum rank is N.
The minimum rank of a non zero matrix is 1.
What is the rank of matrix B?
B <- matrix(c(1,2,1,3,6,3,2,4,2), nrow=3, byrow=TRUE)
B
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 3 6 3
## [3,] 2 4 2
rankMatrix(B)[1]
## [1] 1
A <- matrix(c(1,2,3,0,4,5,0,0,6), nrow=3, byrow=TRUE)
A
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 4 5
## [3,] 0 0 6
Compute the eigenvalues and eigenvectors of the matrix A.
eigen(A)$values
## [1] 6 4 1
Therefore, the charecteristic polynomial is:
(1−λ)(4−λ)(6−λ)
rref(A - 1 * diag(3))
## [,1] [,2] [,3]
## [1,] 0 1 0
## [2,] 0 0 1
## [3,] 0 0 0
With V1=1, we know the Eigen Vector is 1, 0, 0
rref(A - 4 * diag(3))
## [,1] [,2] [,3]
## [1,] 1 -0.6666667 0
## [2,] 0 0.0000000 1
## [3,] 0 0.0000000 0
Here we see V1=V1; V2 = 3*V1/2; V3 = 0
With V2=1, we know the Eigen Vector is 1, 3/2, 0
rref(A - 6 * diag(3))
## [,1] [,2] [,3]
## [1,] 1 0 -1.6
## [2,] 0 1 -2.5
## [3,] 0 0 0.0
We see V1=1.6*V3, V2=2.3V3, V3=V3
With V3=1, the Eigen Vector is 1.6, 2.5, 1