A <- matrix(c(1,2,3,4,
1,0,1,3,
0,1,-2,1,
5,4,-2,-3), 4, byrow=T)
# manually
round(A %*% solve(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
# using function
qr(A)$rank
## [1] 4
This matrix has 4 pivots. It is invertible matrix The rank is the same as dimension
If m
is grater than n
, the maximum rank is n. Assuming that the matrix has at least one non-xero element, its minimum rank should be 1.
B <- matrix(c(1,2,1,3,6,3,2,4,2), 3, byrow=T)
qr(B)$rank
## [1] 1
The matrix B’s rows and columns are dependent, thus our rank is 1.
Based on the following formula,
\({Ax}= \lambda \,x\)
\({det}\left(A-\lambda \,I\right)\,=\,0\)
we find characteristic polynomial and solve for the roots. Subtract unknown lambda frrom the diagonal terms of matrix A to compute determinant.
\({det}\left(\begin{bmatrix}1-\lambda &2&3\\0&4-\lambda &5\\0&0&6-\lambda \end{bmatrix}\right)=0\)
Use algebra and simplify.
\(\left(1-\lambda\right) [\left(4-\lambda \right)\left(6-\lambda \right)-5\times 0] + 2[0 \times \left(6-\lambda \right)-5\times 0] + 3[0\times0 - 0\left(6-\lambda \right)]=0\)
Solve for the roots by setting the equation equal to zero.
\(\left(1-\lambda\right)\left(4-\lambda \right)\left(6-\lambda \right)=0\)
Characteristic Polynomial: \(-\lambda^3 + 11\lambda^2 - 34\lambda + 24=0\)
The roots are 6, 4 and 1. The roots of the polynomial are the eigenvalues of the system.
\(\lambda_1=6, \lambda_2=4, \lambda_3=1\)
\(\lambda_1=6\)
Find vectors x that satisfies the expression when lambda is 6.
\(\left(A-\lambda \,I\right)x\,=\,0\)
\(\begin{bmatrix}1-6 &2&3\\0&4-6 &5\\0&0&6-6 \end{bmatrix}\)
\(\begin{bmatrix}-5 &2&3\\0&-2 &5\\0&0&0 \end{bmatrix}\)
The singular matrix suggest why the lambda is the eigenvalue. Now we solve \(Ax = 0\)
\(\begin{bmatrix}-5&2&3\\0&-2&5\\0&0&0\end{bmatrix}\begin{bmatrix}X\\Y\\Z\end{bmatrix}=0\)
The system of equations:
\(-5x + 2y + 3z = 0\)
\(-2 +5z = 0\)
If the \(Y = 1\), then \(-2 + 5z = 0\) thus \(z = \frac {2}{5}\)
Substitute Y and Z:
\(-5x + 2y + 3\frac {2}{5} = 0\)
\(-5x = \frac{-16}{5}\)
\(x = \frac{16}{25}\)
\(E_{\lambda_1=6}=c\begin{bmatrix}\frac {16}{25} \\ 1 \\ \frac {2}{5}\end{bmatrix}\)
\(\lambda_2=4\)
Find vectors x that satisfies the expression when lambda is 4.
\(\left(A-\lambda \,I\right)x\,=\,0\)
\(\begin{bmatrix}1-4 &2&3\\0&4-4 &5\\0&0&6-4 \end{bmatrix}\)
\(\begin{bmatrix}-3 &2&3\\0&0 &5\\0&0&-2 \end{bmatrix}\)
The singular matrix suggest why the lambda is the eigenvalue. Now we solve \(Ax = 0\)
\(\begin{bmatrix}-3 &2&3\\0&0 &5\\0&0&-2 \end{bmatrix}\begin{bmatrix}X\\Y\\Z\end{bmatrix}=0\)
The system of equations:
\(-3x + 2y + z = 0\)
\(5z = 0\)
\(2z = 0\)
If the \(Y = 1\), then \(X = \frac {2}{3}\)
\(E_{\lambda_2=4}=c\begin{bmatrix} \frac {2}{3} \\ 1 \\ 0 \end{bmatrix}\)
\(\lambda_3=1\)
Find vectors x that satisfies the expression when lambda is 1.
\(\left(A-\lambda \,I\right)x\,=\,0\)
\(\begin{bmatrix}1-1 &2&3\\0&4-1 &5\\0&0&6-1 \end{bmatrix}\)
\(\begin{bmatrix}0&2&3\\0&3&5\\0&0&5\end{bmatrix}\)
The singular matrix suggest why the lambda is the eigenvalue. Now we solve \(Ax = 0\)
\(\begin{bmatrix}0&2&3\\0&3&5\\0&0&5\end{bmatrix}\begin{bmatrix}X\\Y\\Z\end{bmatrix}=0\)
The system of equations:
\(2y + 3z = 0\)
\(3y + 5z = 0\)
\(5z = 0\)
So the only non-zero solution is X = 0, Z = 0.
\(E_{\lambda_3=1}=c\begin{bmatrix}1 \\ 0 \\ 0 \end{bmatrix}\)
# Check with the function
A <- matrix(c(1,2,3,0,4,5,0,0,6), 3, byrow=T)
A
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 4 5
## [3,] 0 0 6
#Eigenvalues
eigen(A)$values
## [1] 6 4 1
#Eigenvectors
eigen(A)$vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0