Question 1: Find the rank of the matrix.

library(pracma)
library(cmna)
## 
## Attaching package: 'cmna'
## The following objects are masked from 'package:pracma':
## 
##     cubicspline, horner, newton, nthroot, romberg, secant, wilkinson
library(Matrix)
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:pracma':
## 
##     expm, lu, tril, triu
A <- matrix(c(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3), nrow=4, byrow=TRUE)

# You can use the rref function to obtain the reduced row-echelon form. Not necessary here.
# RREF_A <- pracma::rref(A)
# print(RREF_A)
A_ref <- cmna::refmatrix(A)   # convert the matrix to row echelon form

print(A_ref)
##      [,1] [,2] [,3]   [,4]
## [1,]    1    2    3  4.000
## [2,]    0    2    4  7.000
## [3,]    0    0   -4 -2.500
## [4,]    0    0    0  1.125
Matrix::rankMatrix(A_ref)[1]
## [1] 4

The rank is 4.

Question 2

If m > n,then this is a rectangular matrix with more rows than columns. The rank has to be no greater than the smaller of the row or column dimension, which is is n. The maximum rank is n. Assuming the matrix is non-zero, the minimum rank is also n.

Question 3

What is the rank of matrix B?

B <- matrix(c(1,2,1,3,6,3,2,4,2), nrow=3, byrow=TRUE)
B_ref <- cmna::refmatrix(B)   # convert the matrix to row echelon form

print(B_ref)
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]  NaN  NaN  NaN

This matrix does not have a row echelon form because when you reduce the equations, it turns out they are all the same. There are 3 variables to solve for and only one equation so there is no solution.

Question 4

C <- matrix(c(1,2,3,0,4,5,0,0,6), nrow=3, byrow=TRUE)
C
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    4    5
## [3,]    0    0    6

Eigenvalues and Eigenvectors of Matrix C

We are given the matrix \(C\):

\[ C = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} \]

The eigenvalues can be found by solving the characteristic equation \(\text{det}(C - \lambda I) = 0\), where \(\lambda\) is the eigenvalue and \(I\) is the identity matrix.

The characteristic equation is given by:

\[ \text{det}(C - \lambda I) = \text{det}\left(\begin{bmatrix} 1-\lambda & 2 & 3 \\ 0 & 4-\lambda & 5 \\ 0 & 0 & 6-\lambda \end{bmatrix}\right) = 0 \]

After solving the characteristic equation, we find the eigenvalues \(\lambda = 1, 4, 6\).

Now, let’s find the eigenvectors for each eigenvalue by solving \((C - \lambda I)\mathbf{v} = \mathbf{0}\).

For \(\lambda = 1\):

\[ (C - \lambda I)\mathbf{v} = \begin{bmatrix} 0 & 2 & 3 \\ 0 & 3 & 5 \\ 0 & 0 & 5 \end{bmatrix}\mathbf{v} = \mathbf{0} \]

The solution gives the eigenvector \(\mathbf{v}_1 = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}\).

For \(\lambda = 4\):

\[ (C - \lambda I)\mathbf{v} = \begin{bmatrix} -3 & 2 & 3 \\ 0 & 0 & 5 \\ 0 & 0 & 2 \end{bmatrix}\mathbf{v} = \mathbf{0} \]

The solution gives the eigenvector \(\mathbf{v}_2 = \begin{bmatrix} 1 \\ 3/2 \\ 0 \end{bmatrix}\).

For \(\lambda = 6\):

\[ (C - \lambda I)\mathbf{v} = \begin{bmatrix} -5 & 2 & 3 \\ 0 & -2 & 5 \\ 0 & 0 & 0 \end{bmatrix}\mathbf{v} = \mathbf{0} \]

The solution gives the eigenvector \(\mathbf{v}_3 = \begin{bmatrix} 1 \\ 5/2 \\ 1 \end{bmatrix}\).

In conclusion, the eigenvalues are \(\lambda = 1, 4, 6\), and the corresponding eigenvectors are \(\mathbf{v}_1 = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}\), \(\mathbf{v}_2 = \begin{bmatrix} 1 \\ 3/2 \\ 0 \end{bmatrix}\), and \(\mathbf{v}_3 = \begin{bmatrix} 1 \\ 5/2 \\ 1 \end{bmatrix}\), respectively.

```