library(Matrix)
\[ A=\left[\begin{array}{cccc} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \end{array}\right] \] To find the rank of a matrix, we will transform that matrix into its echelon form. Then determine the rank by the number of non-zero rows.
We can apply the following elementary transformations:
\[ \mathrm{R}_2 \rightarrow \mathrm{R}_2+ \mathrm{R}_1\\ \mathrm{R}_4 \rightarrow \mathrm{R}_4-5 \mathrm{R}_1\\ \mathrm{R}_3 \rightarrow \mathrm{R}_3-\frac12 \mathrm{R}_2\\ \mathrm{R}_4 \rightarrow \mathrm{R}_4+3 \mathrm{R}_2\\ \mathrm{R}_4 \rightarrow \mathrm{R}_4-\frac54 \mathrm{R}_3\\ \]
Row echelon form is:
\[ A=\left[\begin{array}{cccc} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 0 & -4 & -\frac52 \\ 0 & 0 & 0 & -\frac98 \end{array}\right] \]
Therefore the rank of matrix A = 4.
This is verified with the following rankMatrix()
function from the Matrix
package.
# define matrix A
A = matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3),nrow = 4)
# utilize rankMatrix function to obtain matrix rank
Matrix::rankMatrix(A)[1]
## [1] 4
The maximum rank of an must \(m\)x\(n\) matrix where \(m > n\) be \(n\), because the rank of this matrix is the maximum number of its linearly independent column vectors, which cannot exceed \(n\).
The minimum rank assuming a non-zero matrix is 1.
\[ A=\left[\begin{array}{ccc} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \\ \end{array}\right] \]
Again, we will transform that matrix into its echelon form. Then determine the rank by the number of non-zero rows.
We can apply the following elementary transformations:
\[ \mathrm{R}_2 \rightarrow \mathrm{R}_2-3 \mathrm{R}_1\\ \mathrm{R}_3 \rightarrow \mathrm{R}_3-2 \mathrm{R}_1\\ \]
Row echelon form is:
\[ A=\left[\begin{array}{ccc} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{array}\right] \]
Therefore the Rank of matrix B = 1.
Let’s verify:
# define 3x3
B <- matrix(c(1,3,2,2,6,4,1,3,2),nrow = 3)
#verify
Matrix::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{array}{ccc} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \\ \end{array}\right] \]
Left-hand side Matrix-vector multiplication, right-hand side Scalar multiplication.
\[A\vec{v}=λ\vec{v}\]
Find the values for \(\vec{v}\) and λ that make this equation true.
Convert scalar to matrix multiplication. Do this by creating a matrix with λ down the diagonal with zeros everywhere else as an identity matrix. Common way to annote this is by factoring the lambda out and writing it as identity times \(I\):
\[A\vec{v}=(λI)\vec{v}\]
With both sides looking like matrix vector multiplication, we can subtract out the right-hand side:
\[A\vec{v}-(λI)\vec{v}=\vec{0}\]
Factor out the \(\vec{v}\):
\[(A-λI)\vec{v}=\vec{0}\]
Looking for a matrix such that this new matrix times \(\vec{v}\) gives the \(\vec{0}\). This will always be true if \(\vec{v}\) itself is a \(\vec{0}\), but we want to find a nonzero solution for \(\vec{v}\).
\(det(A-λI)=0\)
To find if a value for λ is an eigenvalue, subtract it from the diagonals of the matrix, and compute the determinant.
First let’s construct the matrix
A = matrix(c(1,0,0,2,4,0,3,5,6), nrow = 3)
Write custom function to compute eigenvalues.
# write function to compute eigenvalues
comp_eig_val <- function(matrix) {
# decompose square matrix with qr
mat_qr <- qr(A)
q <- qr.Q(mat_qr) # find Q
r <- qr.R(mat_qr) # upper triangle
A <- r %*% q # get matrix product
# return results
return(round(diag(A)))
}
# apply function to matrix
(eig_val <- comp_eig_val(A))
## [1] 1 4 6
Using QR decomposition, we found the eigenvalues were 1, 4, and 6. Using this information, we can find the eigenvectors.
This is as far as I got.