Problem set 1
\((1)\) What is the rank of the matrix A?
\[A = \left[\begin{array} {rrr} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \end{array}\right] \] Solution
A <- matrix(c(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3),nrow=4,byrow=TRUE)
det(A)
## [1] -9
Matrix is invertible, so rank of the matrix is its dimention i.e 4.
Using R
#install.packages("matrixcalc")
library(matrixcalc)
cat("Rank of Matrix is ", matrix.rank(A))
## Rank of Matrix is 4
\((2)\) Given an mxn matrix where m > n, what can be the maximum rank? The mini- mum rank, assuming that the matrix is non-zero?
Solution
The rank of a matrix is equal to the minimum of the number of rows and the number of columns (m > n). So in this case, the maximum rank = n.
Assuming matrix is non-zero, it means there is at least one element that is non-zero, Therefore the minimum rank can be 1.
\((3)\) What is the rank of matrix B? \[B = \left[\begin{array}
{rrr}
1 & 2 & 1 \\
3 & 6 & 3 \\
2 & 4 & 2
\end{array}\right]
\] Solution
Method - 1
Using R
B <- matrix(c(1,2,1,3,6,3,2,4,2), byrow = TRUE, ncol = 3)
cat("Rank of Matrix is ", matrix.rank(B))
## Rank of Matrix is 1
Method - 2
Above matrix we can see, R3 is 2R1 and R2 is 3R1.
step 1: \((R2 = R2 - 3R1)\) \[B = \left[\begin{array} {rrr} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 2 & 4 & 2 \end{array}\right] \] step 2: \((R3 = R3 -2R1)\) \[B = \left[\begin{array} {rrr} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right] \] Above matrix there is only one non-zero row, so the rank of B 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}
{rrr}
1 & 2 & 3 \\
0 & 4 & 5 \\
0 & 0 & 6
\end{array}\right]
\] Solution
To find polynomial equation, \(det(A - {\lambda} I) = 0\).
Where I = Identity matrix \[I = \left[\begin{array}
{rrr}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{array}\right]
\]
\[det(A - {\lambda} I) = \left[\begin{array}
{rrr}
1 - \lambda & 2 & 3 \\
0 & 4 - \lambda & 5 \\
0 & 0 & 6 - \lambda
\end{array}\right] = 0
\] Expanding along Row 3
\((6 - \lambda)*(1 - \lambda)*(4 -\lambda) = 0\)
\(-\lambda ^ 3 + 11 \lambda ^ 2 - 34 \lambda + 24 = 0\)
\(\lambda ^ 3 - 11 \lambda ^ 2 + 34 \lambda - 24 = 0\)
The charecterstic polynomial euqtion is,
\(p(A) = \lambda ^ 3 - 11 \lambda ^ 2 + 34 \lambda - 24\)
From quation we get, \((6 - \lambda)*(1 - \lambda)*(4 -\lambda) = 0\)
This means \(\lambda = 1, 4, 6\)
so eigen values are 1, 4, and 6.
Calculation of eigen vectors, \(\lambda = 1\)
\[\left[\begin{array}
{rrr}
0 & 2 & 3 \\
0 & 3 & 5 \\
0 & 0 & 5
\end{array}\right]
\
\left[\begin{array}
{rrr}
v1 \\
v2 \\
v3
\end{array}\right] = 0
\] 5v3 = 0
v3 = 0
3v2 + 5v3 = 0
3v2 = 0
v2 = 0
For λ = 1, its eigenvectors are =
\[\left[\begin{array}
{rrr}
1 \\
0 \\
0
\end{array}\right]\] For λ = 4
\[\left[\begin{array}
{rrr}
-3 & 2 & 3 \\
0 & 0 & 5 \\
0 & 0 & 2
\end{array}\right]
\
\left[\begin{array}
{rrr}
v1 \\
v2 \\
v3
\end{array}\right] = 0
\] 2v3 = 0
v3 = 0
-3v1 + 2v2 + 3v3 = 0
-3v1 + 2v2 = 0
3v1 = 2v2
v1 = 2/3v2
let v2 = 1
v1 = 2/3
For λ = 4, its eigenvectors are =
\[\left[\begin{array}
{rrr}
2/3 \\
1 \\
0
\end{array}\right]\]
For λ = 6
\[\left[\begin{array}
{rrr}
-5 & 2 & 3 \\
0 & -2 & 5 \\
0 & 0 & 0
\end{array}\right]
\
\left[\begin{array}
{rrr}
v1 \\
v2 \\
v3
\end{array}\right] = 0
\]
-2v2 + 5v3 = 0
2v2 = 5v3
v2 = 5/2 v3
-5v1 + 2v2 + 3v3 = 0
5v1 = 2v2 + 3v3
5v1 = 2(5/2)v3 + 3v3
5v1 = (5 + 3)v3
5v1 = 8v3
v1 = 8/5 v3
let v3 = 1
v2 = 5/2
v1 = 8/5
For λ = 6, its eigenvectors are =
\[\left[\begin{array}
{rrr}
8/5 \\
5/2 \\
1
\end{array}\right]\]
Eigenvectors for matrix A are
\[\left[\begin{array}
{rrr}
8/5 \\
5/2 \\
1
\end{array}\right]
\ ,
\left[\begin{array}
{rrr}
2/3 \\
1 \\
0
\end{array}\right]
\ and
\left[\begin{array}
{rrr}
1\\
0 \\
0
\end{array}\right]
\]
To cross check answer, calculate eigen vectors and eigen valus using R.
library(pracma)
A <- matrix(c(1,2,3,0,4,5,0,0,6), byrow = TRUE, ncol = 3)
chac_poly_A <- charpoly(A, info = FALSE)
chac_poly_A
## [1] 1 -11 34 -24
The charecterstic polynomial euqtion is,
\(p(A) = \lambda ^ 3 - 11 \lambda ^ 2 + 34 \lambda - 24\)
eig_values_A <- eigen(A)$values
cat("Eigen values: ",eig_values_A)
## Eigen values: 6 4 1
eig_vectors_A <- eigen(A)$vectors
print("Eigen vectors: ")
## [1] "Eigen vectors: "
eig_vectors_A
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0