What is the rank of the matrix A?
\[\mathbf{A} = \left[\begin{array} {rrr} 1 & 2 & 3 & 4\\ -1 & 0 & 1 & 3\\ 0 & 1 & -2 & -3\\ 5 & 4 & -2 & -3\\ \end{array}\right] \]
In order to find the rank of the matrix A, we need to look at he column space and find the linear independence.
\[C(A)=span(C(A))=span(a_{1}, a_{2}, a_{3}, a_{4}, a_{5})\]
In order to see the linear independence, we need to look at the reduced row echelon of matrix A.
# creating the 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
install.packages('pcarma', repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/Anil Akyildirim/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## Warning: package 'pcarma' is not available (for R version 3.6.1)
library('pracma')
# finding the reduced row echelon with rref() function from pracma package
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
We can see that there is a linear independence on all the vectors and basis dimension is 4. Dimension of the column space is 4. The rank of the Matrix is 4.
Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?
mxn -> m representing the row numbers and n representing the column numbers
m>n rows are greater than the columns so the maximum rank is n(columns)
The matrix is non-zero, meaning there are elements in the matrix, so the rank of the matrix can not be 0. The rank must be at least 1.
What is the rank of matrix B?
\[\mathbf{B} = \left[\begin{array} {rrr} 1 & 2 & 1\\ 3 & 6 & 3\\ 2 & 4 & 2\\ \end{array}\right] \]
Same approach as answer 1 (matrix A). Find the row echelon with rref() function to see the rank of the matrix.
# creating 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
rref(B)
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 0 0 0
## [3,] 0 0 0
We can see that there is a linear independence on one row (row 1) and basis dimension is 1. Dimension of the column space is 1. The rank of the Matrix is 1.
# qr() function that displays the rank of the matrix ($rank)
qr(B)
## $qr
## [,1] [,2] [,3]
## [1,] -3.7416574 -7.483315 -3.741657
## [2,] 0.8017837 0.000000 0.000000
## [3,] 0.5345225 0.000000 0.000000
##
## $rank
## [1] 1
##
## $qraux
## [1] 1.267261 0.000000 0.000000
##
## $pivot
## [1] 1 2 3
##
## attr(,"class")
## [1] "qr"
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.
\[\mathbf{A} = \left[\begin{array} {rrr} 1 & 2 & 3\\ 0 & 4 & 5\\ 0 & 0 & 6\\ \end{array}\right] \]
\[A : Matrix\]
\[\vec{V} : Eigen Vector of A\]
\[\lambda : Eigen Value of A\] \[ I = Identity Matrix\]
\[A\vec{V}=\lambda V\]
\[\vec{V}\neq0\]
\[\vec{0}=\lambda \vec{V} - A \vec{V}\]
\[(\lambda I -A) \vec{V} = \vec{0}\]
\[det(\lambda I - A)=0\]
\[det(\lambda \left[\begin{array}{rrr}1 & 0 & 0\\0 & 1 & 5\\0 & 0 & 1\\\end{array}\right]-\left[\begin{array}{rrr}1 & 2 & 3\\0 & 4 & 5\\0 & 0 & 6\\\end{array}\right])=0\]
\[det(\left[\begin{array}{rrr}\lambda - 1 & \lambda -2 & \lambda -3\\0 & \lambda-4 & -5\\0 & 0 & \lambda-6\\\end{array}\right])\]
\[(\lambda -1)((\lambda-4)(\lambda-6))-0+0+0\]
\[(\lambda -1)(\lambda^2 -10 \lambda +24)\]
The characteristic polynomial is outlined below.
\[\lambda^3 - 11 \lambda^2 + 34 \lambda -24\]
We can confirm this with charpoly() function.
library('pracma')
c <- matrix(c(1,2,3,0,4,5,0,0,6), nrow = 3, byrow = TRUE)
charpoly(c, info=FALSE)
## [1] 1 -11 34 -24
We can also find the
\[\lambda\]
values and vectors of matrix A by using eigen() function
eigen(c)
## 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
We can also confirm this;
\[E=N(\lambda I - A)\]
\[E=N\left[\begin{array}{rrr}\lambda - 1 & \lambda -2 & \lambda -3\\0 & \lambda-4 & -5\\0 & 0 & \lambda-6\\\end{array}\right]\]
We can look at;
\[\lambda = 4\]
\[E = N \left[\begin{array} {rrr} 3 & -2 & -3\\ 0 & 0 & -5\\ 0 & 0 & -2\\ \end{array}\right] \]
Finding the reduced row echelon form of this matrix;
# creating the matrix inside
d <- matrix(c(3,-2,-3,0,0,-5,0,0,-2), nrow = 3, byrow = TRUE)
rref(d)
## [,1] [,2] [,3]
## [1,] 1 -0.6666667 0
## [2,] 0 0.0000000 1
## [3,] 0 0.0000000 0
\[\left[\begin{array}{rrr}1 & -0.6 & 0\\0 & 0 & 1\\0 & 0 & 0\\\end{array}\right] \left[\begin{array}{rrr}V1\\V2\\V3\\\end{array}\right] = \left[\begin{array}{rrr}0\\0\\0\\\end{array}\right]\]
\[V1=0.6V2\]
We can look at;
\[\lambda = 1\]
\[E = N \left[\begin{array} {rrr} 0 & -1 & -2\\ 0 & -3 & -5\\ 0 & 0 & -5\\ \end{array}\right] \]
# creating the matrix inside and finding the reduced row echelon
e <- matrix(c(0,-1,-2,0,-3,-5,0,0,-5), nrow = 3, byrow = TRUE)
rref(e)
## [,1] [,2] [,3]
## [1,] 0 1 0
## [2,] 0 0 1
## [3,] 0 0 0
\[\left[\begin{array}{rrr}1 & 1 & 0\\0 & 0 & 1\\0 & 0 & 0\\\end{array}\right] \left[\begin{array}{rrr}V1\\V2\\V3\\\end{array}\right] = \left[\begin{array}{rrr}0\\0\\0\\\end{array}\right]\]
We can look at;
\[\lambda = 6\]
\[\left[\begin{array}{rrr}5 & 4 & 3\\0 & 2 & -5\\0 & 0 & 0\\\end{array}\right] \left[\begin{array}{rrr}V1\\V2\\V3\\\end{array}\right] = \left[\begin{array}{rrr}0\\0\\0\\\end{array}\right]\]
# creating the matrix inside and finding the reduced row echelon
f <- matrix(c(5,4,3,0,-2,-5,0,0,0), nrow = 3, byrow = TRUE)
rref(f)
## [,1] [,2] [,3]
## [1,] 1 0 -1.4
## [2,] 0 1 2.5
## [3,] 0 0 0.0
\[\left[\begin{array}{rrr}1 & 0 & -1.4\\0 & 0 & 1\\0 & 0 & 0\\\end{array}\right] \left[\begin{array}{rrr}V1\\V2\\V3\\\end{array}\right] = \left[\begin{array}{rrr}0\\0\\0\\\end{array}\right]\]
\[1.4V1=V3\]