#Installing pracma package
install.packages("pracma", dependencies = TRUE, repos = "http://mirrors.nics.utk.edu/cran/")
## Installing package into 'C:/Users/Lelan/Documents/R/win-library/3.4'
## (as 'lib' is unspecified)
## package 'pracma' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\Lelan\AppData\Local\Temp\RtmpM14k6g\downloaded_packages
library(pracma)

Problem Set 1

  1. What is the rank of the matrix A?

\(A = \left( \begin{array}{ccc} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3\end{array} \right)\)

#Create matrix
ps1 <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3),nrow=4)
#Create reduced row echelon matrix
ps1_r <- rref(ps1)
ps1_r
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    0
## [2,]    0    1    0    0
## [3,]    0    0    1    0
## [4,]    0    0    0    1

The reduced row echelon form of A has 4 non-zero rows, so the rank is 4.


  1. Given an m x n matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

The maximum rank is n (the smaller of the row or column matrix). The minimum rank is 1. Any matrix with a single non-zero element has a rank of 1.

  1. What is the rank of matrix B?

\(B = \left( \begin{array}{ccc} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \end{array} \right)\)

#Create matrix
ps3 <- matrix(c(1,3,2,2,6,4,1,3,2),nrow=3)
ps3
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
#Create reduced-row echelon matrix
ps3_r <- rref(ps3)
ps3_r
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0

The row echelon form of B has one non-zero row, so the rank is 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 = \left( \begin{array}{ccc} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{array} \right)\)

To find the potential eigenvalues, we need to compute find det(\(\lambda I_n - A) = 0\):

\(\left( \begin{array}{ccc} \lambda & 0 & 0 \\ 0 & \lambda & 0 \\ 0 & 0 & \lambda \end{array} \right)\) - \(\left( \begin{array}{ccc} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{array} \right)\) = \(\left( \begin{array}{ccc} \lambda-1 & -2 & -3 \\ 0 & \lambda-4 & -5 \\ 0 & 0 & \lambda-6 \end{array} \right)\) = 0

Using the Rule of Sarros on the resulting matrix we see that 2 of the diagonals we’re multiplying and adding have a product of zero, and all of the diagnoals we’re multiplhing and subracting have a product of zero. This leaves us with only one non-zero diagonal, which is:

\((\lambda-1)(\lambda-4)(\lambda-6) = 0\)

Thus, the potential eigenvalues are 1, 4 and 6.

I calculated the eigenvector using R. I am not sure how to compute the eigenvectors by hand for a 3-dimensional matrix:

A <- matrix(c(1,2,3,0,4,5,0,0,6),nrow=3,byrow=TRUE)
eigen(A)
## 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