library(pracma)
library(Matrix)
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:pracma':
## 
##     expm, lu, tril, triu
  1. What is the rank of the matrix A? \[ \begin{equation*} \mathbf{}\left[\begin{matrix} 1 & 2 & 3 & 4\\ -1 & 0 & 1 & 3\\ 0 & 1 & -2 & 1\\ 5 & 4 & -2 & -3 \end{matrix}\right] \end{equation*} \]
A <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3),nrow = 4,ncol=4)
#reduced row echelon form
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 get an identity matrix as the reduced row echelon form of matrix A. Looking at the rows, there are no non-zero rows when reduced, therefore the rank is 4. We can confirm with the following:

rankMatrix(A)[1]
## [1] 4
  1. 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 has to be the lesser of m or n, and in the question, n < m, therefore, the maximum rank is n. The minimum rank would be 1 if non-zero.

(3). What is the rank of matrix B? B= \[ \begin{equation*} \mathbf{}\left[\begin{matrix} 1 & 2 & 1\\ 3 & 6 & 3\\ 2 & 4 & 2 \end{matrix}\right] \end{equation*} \]

B <- matrix(c(1,3,2,2,6,4,1,3,2),nrow = 3,ncol=3)
#reduced row echelon form of B
rref(B)
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0

There is only one non-zero row, therefore the rank of B is 1. Can verify with:

rankMatrix(B)[1]
## [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= \[ \begin{equation*} \mathbf{}\left[\begin{matrix} 1 & 2 & 3\\ 0 & 4 & 5\\ 0 & 0 & 6 \end{matrix}\right] \end{equation*} \]

A <- matrix(c(1,0,0,2,4,0,3,5,6),nrow = 3,ncol=3)
eigen(A)$values
## [1] 6 4 1
eigen(A)$vectors
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0
charpoly(A)
## [1]   1 -11  34 -24

The eigenvalues of A are 6,4,1. The eigenvector is shown above. The numeric values for the characteristic polynomials are 1, -11, 34, -24. I’ve attached a handwritten version separately as I was not too sure how to show the steps in R.