\(A = \left( \begin{matrix} 1&2&3&4 \\ -1&0&1&3 \\ 0&1&-2&1 \\ 5&4&-2&-3 \end{matrix} \right)\)
A <- matrix(cbind(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3), byrow = T, 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
# to calc matrix rank using rankMatrix function from Matrix pkg
require(Matrix)
## Loading required package: Matrix
rankMatrix(A)[1]
## [1] 4
For mxn matrix where m>n, the rank would be n if all n column are linearly independent. Assuming matrix is non-zero, the minimum rank would be 1 given at least 1 pivot.
\(B = \left( \begin{matrix} 1&2&1 \\ 3&6&3 \\ 2&4&2 \end{matrix} \right)\)
B <- matrix(cbind(1,2,1,3,6,3,2,4,2), byrow = T, ncol = 3)
B
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 3 6 3
## [3,] 2 4 2
Seeing the matrix B, row 2 is 3 times row 1 and row 3 is 2 times row 1 so we ended up having only one linear independent row therfore rank of B is 1.
here is using R.
rankMatrix(B)[1]
## [1] 1
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{matrix} 1&2&3 \\ 0&4&5 \\ 0&0&6 \end{matrix} \right)\)
Link to solve this problem by hand https://github.com/amit-kapoor/data605/blob/master/607Assign3-Prob2-Manual.pdf
Please show your work using an R-markdown document.
library(pracma)
##
## Attaching package: 'pracma'
## The following objects are masked from 'package:Matrix':
##
## expm, lu, tril, triu
A <- matrix(cbind(1,2,3,0,4,5,0,0,6), byrow = T, ncol = 3)
A
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 4 5
## [3,] 0 0 6
# to computes the characteristic polynomial
charpoly(A)
## [1] 1 -11 34 -24
eig <- eigen(A)
# eigen values of A
eig$values
## [1] 6 4 1
# eigen vectors of A
eig$vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0