1. What is the rank of the matrix A?
$$ \[\begin{bmatrix}{} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & 3 \\ \end{bmatrix}\]

$$

library(Matrix)
library(pracma)
## 
## Attaching package: 'pracma'
## The following objects are masked from 'package:Matrix':
## 
##     expm, lu, tril, triu
A<-matrix(c(1,0,0,0,2,2,1,6,3,4,-2,-17,4,7,1,-23), nrow=4)
#show the 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
#So there are 4 pivots so rank=4
# Or use r


rankMatrix(A)
## [1] 4
## attr(,"method")
## [1] "tolNorm2"
## attr(,"useGrad")
## [1] FALSE
## attr(,"tol")
## [1] 8.881784e-16

So Rank is 4. ____________________________________________________ (2) Given an mxn matrix where m > n, what can be the maximum rank?

The maximum rank can be the smallest dimension==>n

The minimum rank, assuming that the matrix is non-zero? The minimum rank of a non-zero matrix =1. ___________________________________________________ (3) What is the rank of matrix B?

$$ \[\begin{bmatrix}{} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \\ \end{bmatrix}\]

$$

B<-matrix(c(1,3,2,2,6,4,1,3,2),nrow=3)
rref(B)
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0
# from reduced row echelon form we see 1 pivot so 
#rank=1

#From rankMatrix function, rank is 1
rankMatrix(B)
## [1] 1
## attr(,"method")
## [1] "tolNorm2"
## attr(,"useGrad")
## [1] FALSE
## attr(,"tol")
## [1] 6.661338e-16
  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.

\[ \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5\\ 0 & 0 & 6\\ \end{bmatrix} \] Need

\[\det (\lambda I-A)=0\] Using Rule of Sarrus: \[\begin{vmatrix} \lambda-1 & -2 & -3 & \lambda-1 & -2\\ 0 & \lambda-4 & -5 & 0 & \lambda-4 \\ 0 & 0 & \lambda-6 & 0 &0 \\ \end{vmatrix} \]

\[ \begin{align*} (\lambda-1 ) (\lambda-4 ) (\lambda-6 ) = 0\\ \end{align*} \]

Characteristic polynomial with roots: 1, 4, 6

Now compute eigen vectors, so start with

\(\lambda=1\) \[\begin{bmatrix} \lambda-1 & -2 & -3 \\ 0 & \lambda-4 & -5 \\ 0 & 0 & \lambda-6 \\ \end{bmatrix} \] \(\lambda=1\)

\[\begin{bmatrix} 0 & -2 & -3 \\ 0 & -3 & -5 \\ 0 & 0 & -5 \\ \end{bmatrix} \]

reduced row echelon form

$$

\[\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \\ \end{bmatrix}\] \[\begin{bmatrix} v1 \\ v2 \\ v3 \\ \end{bmatrix}\]

$$

so \[ \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} \]

we still have eigenvalues 4,6.

Use r function Compute all Eigenvectors that correspond to eigenvalues……

Using r to compute Eigenvector, eigenvalue,characteristic polynomial:

A<-matrix(c(1,0,0,2,4,0,3,5,6),nrow=3)
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
charpoly(A)
## [1]   1 -11  34 -24

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.