To determine the rank of matrix A, we could put it into rref and count the number of pivot columns or take the nullspace of the matrix.
Start with the matrix:
\(\begin{bmatrix} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \end{bmatrix}\)
library(pracma)
A <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3) ,4 ,4)
rref(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
nullspace(A)
## NULL
A row reduces to the identity matrix, and, as expected its nullspace is empty.
The rank is therefore 4.
The rank of the column space equals the rank of the rowspace. The rank is equal to the number of linearly independent rows or columns. Since A has n columns and m > n, A can have a rank of, at most, n.
Since A is not the zero matrix, it must have at least one column. The rank must be at least 1.
For the matrix: \(\begin{bmatrix} 1 & 2 & 1 \\ 0 & 4 & 5 \\ 2 & 4 & 2 \end{bmatrix}\)
we will use the same technique as problem 1.
A <- matrix(c(1,0,2,2,4,4,1,5,2),3,3)
rref(A)
## [,1] [,2] [,3]
## [1,] 1 0 -1.50
## [2,] 0 1 1.25
## [3,] 0 0 0.00
nullspace(A)
## [,1]
## [1,] 0.6837635
## [2,] -0.5698029
## [3,] 0.4558423
The matrix has two pivots in rref, and, as expected, a nullspace with dimension 1.
The rank of A is therefore 2.
A is an upper triangular matrix, so its determinant will be the product of its diagonal entries. We need to solve:
\(\begin{vmatrix} 1-\lambda & 2 & 3 \\ 0 & 4-\lambda & 5 \\ 0 & 0 & 6-\lambda \end{vmatrix}=\quad 0\)
This is our characteristic polynomial:
\((1-\lambda) (4-\lambda) (6-\lambda) = 0\)
The eigenvalues are: \(\lambda=(1,4,6)\)
To get the eigenvectors, we compute the nullspace of \(A-\lambda I\)
For \(\lambda=-1\)
\(\begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix}-(1)I\)
=\(\begin{bmatrix} 0 & 2 & 3 \\ 0 & 3 & 5 \\ 0 & 0 & 5 \end{bmatrix}\)
By inspection, we can see that any vector with the second and third entries being 0 will work as a solution.
the eigenvector is \(\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}\)
For \(\lambda = 4\):
we must find the nullspace of \(\begin{bmatrix} -3 & 2 & 3 \\ 0 & 0 & 5 \\ 0 & 0 & 2 \end{bmatrix}\)
divide row 1 by -3: \(\begin{bmatrix} 1 & -2/3 & -1 \\ 0 & 0 & 5 \\ 0 & 0 & 2 \end{bmatrix}\)
divide row 2 by 5 and zero out rows 1 and 3: \(\begin{bmatrix} 1 & -2/3 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}\)
The eigenvector is \(\begin{bmatrix} 2/3 \\ 1 \\ 0 \end{bmatrix}\)
For \(\lambda=6\):
We find the nullspace of \(\begin{bmatrix} -5 & 2 & 3 \\ 0 & -2 & 5 \\ 0 & 0 & 0 \end{bmatrix}\)
divide the first row by -5: \(\begin{bmatrix} 1 & -2/5 & -3/5 \\ 0 & -2 & 5 \\ 0 & 0 & 0 \end{bmatrix}\)
divide the second row by -2: \(\begin{bmatrix} 1 & -2/5 & -3/5 \\ 0 & 1 & -5/2 \\ 0 & 0 & 0 \end{bmatrix}\)
Add 2/5 times the second row to the first row: \(\begin{bmatrix} 1 & 0 & -8/5 \\ 0 & 1 & -5/2 \\ 0 & 0 & 0 \end{bmatrix}\)
The eigenvector is \(\begin{bmatrix} 8/5 \\ 5/2 \\ 1 \end{bmatrix}\)
The set of eigenvectors is: \(\begin{bmatrix} 8/5 \\ 5/2 \\ 1 \end{bmatrix},\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix},\begin{bmatrix} 2/3 \\ 1 \\ 0 \end{bmatrix}\)
Checking the work:
A <- matrix(c(1,0,0,2,4,0,3,5,6),3,3)
eigen(A)
## eigen() decomposition
## $values
## [1] 6 4 1
##
## $vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0
Our solutions are scalar multiples of these eigenvectors, and we could arrive at these by setting our’s to be length 1.