1. Problem set 1

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

library(pracma)
## Warning: package 'pracma' was built under R version 3.4.4
#Create a matrix
A<- matrix(c(1,-1,0,5, 2,0,1,4, 3,1,-2,-2, 4,3,1,-3),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
#Using qr function calculate rank
rankA <- qr(A)
rankA$rank
## [1] 4

Rank of Matrix A is 4 #(2) Given an mxn matrix where m > n, what can be the maximum rank? The mini- mum rank, assuming that the matrix is non-zero? Since the pivot columns of A form a basis for ColA, the rank of A is just the number of pivot columns in A. Therefore the maximum rank in the case is rank(A)=n.

Since A is non-zero, there exists a minimum one non-zero column in echelon reduction form, Therefore the minmum rank is 1 #(3) What is the rank of matrix B?

B<- matrix(c(1,3,2, 2,6,4, 1,3,2),ncol = 3)
B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
rankB<-qr(B)
rankB$rank
## [1] 1

The rank of matrix B is 1

2. 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.

#define matrix
A<-matrix(c(1,0,0, 2,4,0, 3,5,6),ncol = 3)

cp<-charpoly(A)

#Characteristic polynomial
cp
## [1]   1 -11  34 -24

Characteristic polynomial equation for given matrix is 1x3−11x2+34x−24

ev = eigen(A)
ev$values
## [1] 6 4 1

Roots are x=6,x=4 and x=1

lambda = ev$values[1]
lambdaI = lambda * diag(3)

result = A - lambdaI

#using pracma library get reduced row echelon form for result
rrefMx = rref(result)
rrefMx
##      [,1] [,2] [,3]
## [1,]    1    0 -1.6
## [2,]    0    1 -2.5
## [3,]    0    0  0.0
lambda = ev$values[2]
lambdaI = lambda * diag(3)

result = A - lambdaI

#using pracma library get reduced row echelon form for result
rrefMx = rref(result)
rrefMx
##      [,1]       [,2] [,3]
## [1,]    1 -0.6666667    0
## [2,]    0  0.0000000    1
## [3,]    0  0.0000000    0
lambda = ev$values[3]
lambdaI = lambda * diag(3)

result = A - lambdaI

#using pracma library get reduced row echelon form for result
rrefMx = rref(result)
rrefMx
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2,]    0    0    1
## [3,]    0    0    0
#eigenvectors values from eigen function
ev$vectors
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0
#for lambda to 6
ev$values[1]
## [1] 6
es = ev$vectors[,1]
es
## [1] 0.5108407 0.7981886 0.3192754
#let minT be min value of vector
minT = min(es)
#for lambda to 4
ev$values[2]
## [1] 4
es = ev$vectors[,2]
es
## [1] 0.5547002 0.8320503 0.0000000
#let minT be min value of vector
minT = min(es[es > 0])
#for lambda to 1
ev$values[3]
## [1] 1
es = ev$vectors[,3]
es
## [1] 1 0 0
#let minT be min value of vector
minT = min(es[es > 0])

Eigenspace values are the same.