What is the rank of the matrix A?

The rank is 4. Since its only necessary to RREF until the Lower Triangle has been calculated, we you can stop without needing to go all the way to RREF. All rows will be none zero rows in final RREF.

[ \[\begin{alignat*}{2} \left(\begin{array}{rrrr} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -2 \end{array}\right) &\xrightarrow{r_2 = r_1+r_2} \left(\begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -2 \end{array}\right) &\xrightarrow{r_4 = r_4-5r_1} \left(\begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 1 & -2 & 1 \\ 0 & -6 & -17 & -22 \end{array}\right) &\xrightarrow{r_3 = 2r_3-r_2} \left(\begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 0 & -8 & 5 \\ 0 & -6 & -17 & -22 \end{array}\right) \\ \\ &\xrightarrow{r_4 = r_4+3r_2} \left(\begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 0 & -8 & 5 \\ 0 & 0 & -5 & -1 \end{array}\right) &\xrightarrow{r_3 = -1/8r_2} \left(\begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 0 & 1 & -.625 \\ 0 & 0 & -5 & -1 \end{array}\right) &\xrightarrow{r_4 = r_4+5r_3} \left(\begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 0 & 1 & -.625 \\ 0 & 0 & 0 & -4.125 \end{array}\right) \end{alignat*}\] ]

# Confirm the rank of A

# Load the Matrix package
#install.packages("Matrix")
library(Matrix)

# Define matrix A
A <- matrix(c(1, 2, 3, 4,
             -1, 0, 1, 3,
              0, 1, -2, 1,
              5, 4, -2, -2), nrow = 4, byrow = TRUE)

# Calculate the rank of the matrix A
matrix_rank <- rankMatrix(A)

# Print the rank
print(paste("The rank of the matrix is:", matrix_rank))
## [1] "The rank of the matrix is: 4"


Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

The maximum rank of the matrix can be n since there are n columns and since the maximum number of linearly independent columns can be n.

The minimum rank it can have is 1. A rank of zero would imply that all entries in the matrix are zero. A rank of 1 means that at least one row or column is linearly independent


What is the rank of matrix B?

The rank for matrix B is 1. After RREF, only 1 non zero row remains.

\[ \begin{alignat*}{2} \left(\begin{array}{rrr} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \end{array}\right) &\xrightarrow{r_2 = r_2-3r_1} \left(\begin{array}{rrrr} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 2 & 4 & 2 \end{array}\right) &\xrightarrow{r_3 = r_3-2r_1} \left(\begin{array}{rrrr} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right) \end{alignat*} \]

# Confirm the rank of B

# Define matrix B
B <- matrix(c(1, 2, 1,
              3, 6, 3,
              2, 4, 2), nrow = 3, byrow = TRUE)

# Calculate the rank of the matrix B
matrix_rank <- rankMatrix(B)

# Print the rank
print(paste("The rank of the matrix is:", matrix_rank))
## [1] "The rank of the matrix is: 1"


Compute the eigenvalues of matrix A.

1. Substract the lambda identity matrix from matrix A

\[ A - \lambda I = \begin{pmatrix} 1-\lambda & 2 & 3 \\ 0 & 4-\lambda & 5 \\ 0 & 0 & 6-\lambda \end{pmatrix} \]

2. Calculate the Determinant using the Rule of Sarrus

The determinant of a 3x3 triangular matrix can be calculated by multiplying and adding the diagonals and then subtracting the reverse diagonals.

\[ \begin{pmatrix} 1-\lambda & 2 & 3 \\ 0 & 4-\lambda & 5 \\ 0 & 0 & 6-\lambda \end{pmatrix} \begin{pmatrix} 1-\lambda & 2 \\ 0 & 4-\lambda \\ 0 & 0 \end{pmatrix} \]


\[ \text{det}(A - \lambda I) = ((1-\lambda)(4-\lambda)(6-\lambda) + (2*5*0) + (3*0*0))- ((2*0*(6-\lambda)+ ((1-\lambda)*5*0)+ (3*(4-\lambda)*0)\\ = ((1-\lambda)(4-\lambda)(6-\lambda) + 0 + 0 - 0 + 0 + 0 \]

3. Characteristic Polynomial of Matrix A

After simplification, the characteristic polynomial equatioonis

\[ 0 = (1-\lambda)(4-\lambda)(6-\lambda) \]

4. Solve for \(\lambda\) to get eigenvalues

\[ \lambda_1 = 1, \quad \lambda_2 = 4, \quad \lambda_3 = 6 \]

# Verify the eigenvalues

# Define the matrix A
A_matrix <- matrix(c(1, 2, 3,
                     0, 4, 5,
                     0, 0, 6), nrow = 3, byrow = TRUE)

# Calculate the eigenvalues and eigenvectors
eigen_result <- eigen(A_matrix)

# Extract the eigenvalues
eigen_values <- eigen_result$values

# Extract the eigenvectors
eigen_vectors <- eigen_result$vectors

# Print the eigenvalues
print(eigen_values)
## [1] 6 4 1


Compute the eigenvectors of Matrix A.

To calculate the eigenvectors for each eigenvalue, we substitute the values in the lambda matrix and solve the \(A - \lambda I\)

\[ A - \lambda I = \begin{pmatrix} 1-\lambda & 2 & 3 \\ 0 & 4-\lambda & 5 \\ 0 & 0 & 6-\lambda \end{pmatrix} \]

Eigenvalue \(\lambda = 6\)

1. Subtract \(\lambda I\) from Matrix A and augment matrix

\[ \left(\begin{array}{rrr|r} -5 & 2 & 3 & 0 \\ 0 & -2 & 5 & 0 \\ 0 & 0 & 0 & 0 \end{array}\right) \]

2. RREF the Augmented Matrix A

\[ R1 = -\frac{1}{5} R1 \left(\begin{array}{rrr|r} 1 & -\frac{2}{5} & -\frac{3}{5} & 0 \\ 0 & -2 & 5 & 0 \\ 0 & 0 & 0 & 0 \end{array}\right) R2 = -\frac{1}{2} R2 \left(\begin{array}{rrr|r} 1 & -\frac{2}{5} & -\frac{3}{5} & 0 \\ 0 & 1 & -\frac{5}{2} & 0 \\ 0 & 0 & 0 & 0 \end{array}\right) R1 = R1 + \frac{2}{5} R2 \left(\begin{array}{rrr|r} 1 & 0 & -\frac{11}{5} & 0 \\ 0 & 1 & -\frac{5}{2} & 0 \\ 0 & 0 & 0 & 0 \end{array}\right) \]

3. RREF of Matrix A

\[ \left(\begin{array}{rrr|r} 1 & 0 & -\frac{11}{5} & 0 \\ 0 & 1 & -\frac{5}{2} & 0 \\ 0 & 0 & 0 & 0 \end{array}\right) \]

4. Solve for \(x_1, x_2, x_3\)

Eigenvectors for \(\lambda = 6\):

\[ x_1 = \frac{11}{5}x_3\\ x_2 = \frac{5}{2}x_3\\ x_3 = \frac{2}{5}x_2 \]

Eigenvalue \(\lambda = 4\)

Repeat Steps for Matrix A for \(\lambda = 4\)

\[ \left(\begin{array}{rrr|r} -3 & 2 & 3 & 0 \\ 0 & 0 & 5 & 0 \\ 0 & 0 & 2 & 0 \end{array}\right) \]

Eigenvalue \(\lambda = 1\)

Repeat Steps for Matrix A for \(\lambda = 1\)

\[ \left(\begin{array}{rrr|r} 0 & 2 & 3 & 0 \\ 0 & 3 & 5 & 0 \\ 0 & 0 & 5 & 0 \end{array}\right) \]

# Verify eigenvectors for Matrix A

# Define the matrix A
A_matrix <- matrix(c(1, 2, 3,
                     0, 4, 5,
                     0, 0, 6), nrow = 3, byrow = TRUE)

# Calculate the eigenvalues and eigenvectors
eigen_result <- eigen(A_matrix)

# Extract the eigenvectors
eigen_vectors <- eigen_result$vectors

# Print the eigenvectors
print("The eigenvectors are:")
## [1] "The eigenvectors are:"
print(eigen_vectors)
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0
# Find the index of the eigenvalue 6
index_lambda_6 <- which(eigen_values == 6)

# Extract the eigenvector for eigenvalue 6
eigen_vector_lambda_6 <- eigen_vectors[, index_lambda_6]

# Print the eigenvector for eigenvalue 6
print(paste("The eigenvector corresponding to eigenvalue 6 is:"))
## [1] "The eigenvector corresponding to eigenvalue 6 is:"
print(eigen_vector_lambda_6)
## [1] 0.5108407 0.7981886 0.3192754
# Find the index of the eigenvalue 4
index_lambda_4 <- which(eigen_values == 4)

# Extract the eigenvector for  eigenvalue 4
eigen_vector_lambda_4 <- eigen_vectors[, index_lambda_4]

# Print the eigenvector for eigenvalue 4
print(paste("The eigenvector corresponding to eigenvalue 4 is:"))
## [1] "The eigenvector corresponding to eigenvalue 4 is:"
print(eigen_vector_lambda_4)
## [1] 0.5547002 0.8320503 0.0000000
# Find the index of the eigenvalue 1
index_lambda_1 <- which(eigen_values == 1)

# Extract the eigenvector for eigenvalue 1
eigen_vector_lambda_1 <- eigen_vectors[, index_lambda_1]

# Print the eigenvector for eigenvalue 1
print(paste("The eigenvector corresponding to eigenvalue 1 is:"))
## [1] "The eigenvector corresponding to eigenvalue 1 is:"
print(eigen_vector_lambda_1)
## [1] 1 0 0