# Define matrix A.
A <- matrix(c(1, 2, 3, 4, -1, 0, 1, 3, 0, 1, -2, 1, 5, 4, -2, -3), 4, 4, byrow = TRUE)
# Calculate the Rank of matrix A.
matrix_rank <- rankMatrix(A)[1]
# Output the result.
matrix_rank
## [1] 4
Answer: The rank of matrix A is 4.
Answer: Given the fact that \(m > n\), then the maximum rank is \(n\). If the matrix contains at least one non-zero element, then its minimum rank is 1.
# Define matrix B.
B <- matrix(c(1, 2, 1, 3, 6, 3, 2, 4, 2), 3, 3, byrow = TRUE)
# Calculate the Rank of matrix B.
matrix_rank <- rankMatrix(B)[1]
# Output the result.
matrix_rank
## [1] 1
Answer: The rank of martix B is 1.
# Define matrix A.
A <- matrix(c( 1, 2, 3, 0, 4, 5, 0, 0, 6), 3, 3, byrow = TRUE)
# Find the characteristic polynomial of matrix A.
matrix_a_char_poly <- charpoly(A, info = TRUE)
## Error term: 0
# Output the result.
matrix_a_char_poly
## $cp
## [1] 1 -11 34 -24
##
## $det
## [1] 24
##
## $inv
## [,1] [,2] [,3]
## [1,] 1 -0.50 -0.08333333
## [2,] 0 0.25 -0.20833333
## [3,] 0 0.00 0.16666667
Answer: The characteristic polynomial of matrix A is \(\lambda^3 - 11\lambda^2 + 34\lambda - 24 = 0\).
# Get the Eigenvalues of Matrix A.
eigen <- eigen(A)
eigen_values <- eigen$values
# Output the result.
eigen_values
## [1] 6 4 1
Answer: The eigenvalues of matrix A are 6, 4, and 1.
# Get the Eigenvectors of Matrix A.
eigen_vectors <- eigen$vectors
# Output the result.
eigen_vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0
Answer: The eigenvectors of matrix A are as follows:
\(\lambda = 6\),
\(\left[\begin{array}{}0.5108407 \\0.7981886 \\0.3192754\end{array}\right]\)
\(\lambda = 4\),
\(\left[\begin{array}{}0.5547002 \\0.8320503 \\0\end{array}\right]\)
\(\lambda = 1\),
\(\left[\begin{array}{}1 \\0 \\0\end{array}\right]\)