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),nrow=4,ncol=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
y<- qr(A)
y$rank
## [1] 4
  1. Given an mxn matrix where m > n, what can be the maximum rank? The mini- mum rank, assuming that the matrix is non-zero?

Answer: The maximum rank is n and minimum rank is 1 if the matrix is non-zero.

  1. What is the rank of matrix B?
A <- matrix(c(1,2,1,3,6,3,2,4,2),nrow=3,ncol=3, byrow=TRUE)
A
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
y<- qr(A)
y$rank
## [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),nrow=3,ncol=3, byrow=TRUE)
A 
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    4    5
## [3,]    0    0    6
I <- diag(x=1,nrow=3, ncol=3)

#eigenvalues
#det(A - x*I) = 0
#(1-x)*(4-x)*(6-x)=0
x1=1
x2=4
x3=6

#test eigenvalues
det(A - x1*I)
## [1] 0
det(A - x2*I)
## [1] 0
det(A - x3*I)
## [1] 0
#eigenvetors

library("pracma")
## Warning: package 'pracma' was built under R version 3.4.3
#x1=1
m1<-A-x1*I
rref(m1)
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2,]    0    0    1
## [3,]    0    0    0
# N(A - x1*I) = c(1,0,0)


#x2=4
m2<-A-x2*I
rref(m2)
##      [,1]       [,2] [,3]
## [1,]    1 -0.6666667    0
## [2,]    0  0.0000000    1
## [3,]    0  0.0000000    0
# N(A - x2*I) = c(0.66667,1,0)


#x3=6
m3<-A-x3*I
rref(m3)
##      [,1] [,2] [,3]
## [1,]    1    0 -1.6
## [2,]    0    1 -2.5
## [3,]    0    0  0.0
# N(A - x3*I) = c(1.6,2.5,1)