1. Problem set 1
  1. What is the rank of the matrix A?

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

Answer:

Rank A = dim(colA) = # pivot columns in A

\[ A = \begin{bmatrix} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \end{bmatrix} -> R2+R1 -> \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \end{bmatrix} -> R2-R3 -> \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \end{bmatrix} ->-5R1+R4-> \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 1 & -2 & 1 \\ 0 & -6 & -17 & -23 \end{bmatrix} \]

\[ ->6R2+R4 -> \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 1 & -2 & 1 \\ 0 & 0 & 19 & 13 \end{bmatrix} -> R2-R3 ->\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 8 & 5 \\ 0 & 0 & 19 & 13 \end{bmatrix} -> R4-2R3 -> \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 8 & 5 \\ 0 & 0 & 3 & 3 \end{bmatrix} \]

\[ -> (1/3)R4 -> \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 8 & 5 \\ 0 & 0 & 1 & 1 \end{bmatrix} -> (5/8)R3 ->\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 1 & \frac{5}{8} \\ 0 & 0 & 1 & 1 \end{bmatrix} ->R4-R3 ->\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 1 & \frac{5}{8} \\ 0 & 0 & 0 & \frac{3}{8} \end{bmatrix} \]

\[ -> (8/3)R4 -> \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 1 & \frac{5}{8} \\ 0 & 0 & 0 & 1 \end{bmatrix} \]

No of Pivot column = 4

Dim column = 4

Rank A = 4

library(pracma)
## Warning: package 'pracma' was built under R version 4.2.3
A <- matrix(c(1, 2, 3, 4, -1, 0, 1, 3, 0, 1, -2, 1, 5, 4, -2, -3), nrow = 4, byrow = TRUE)
A
##      [,1] [,2] [,3] [,4]
## [1,]    1    2    3    4
## [2,]   -1    0    1    3
## [3,]    0    1   -2    1
## [4,]    5    4   -2   -3
rank_A <- Rank(A)
cat("Rank of Matrix A is:", rank_A, "\n")
## Rank of Matrix A is: 4
  1. Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

If m > n, maximum rank is equal to n.

If m < n, maximum rank is equal to m.

Minimum rank is 1 for non-zero matrix. This is because a non-zero matrix always has at least one linearly independent row or column.

  1. What is the rank of matrix B?

\[ B = \begin{bmatrix} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \end{bmatrix} \]

Answer:

\[ B = \begin{bmatrix} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \end{bmatrix} -> R2-3R1 -> \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 2 & 4 & 2 \end{bmatrix} ->R3-2R2-> \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}\]

No of Pivot column = 1

Dim column = 1

Rank B = 1

B <- matrix(c(1, 2, 1, 3, 6, 3, 2, 4, 2), nrow = 3, byrow = TRUE)
B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
rank_B <- Rank(B)
cat("Rank of Matrix B is:", rank_B, "\n")
## Rank of Matrix B is: 1
  1. Problem set 2

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 = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} \]

Answer:

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

\[ Characteristic\ Equation = -(\lambda-1)(\lambda-4)(\lambda-6) \] \[ Characteristic\ polynomial = -\lambda^3+11\lambda^2-34\lambda+24 \]

\[ Eigenvalues:\\ \lambda=1\\\lambda=4\\\lambda=6 \]

\[ Eigenvectors: \\(A-\lambda)\bar{x} = 0 \]

\[ \lambda=6 \]

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

The reduced row echelon form of the matrix is

\[ \begin{bmatrix} 1 & 0 & -\frac{8}{5} \\ 0 & 1 & -\frac{5}{2} \\ 0 & 0 & 0 \end{bmatrix} \]

Finding the null space will give us eigenvector

\[ \begin{bmatrix} 1 & 0 & -\frac{8}{5} \\ 0 & 1 & -\frac{5}{2} \\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} x1 \\ x2 \\ x3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \]

\[ x1 = \frac{8}{5}x3,\ x2=\frac{5}{2}x3,\ x3\ is\ free\ variable \\ Thus, Null\ Space = x3\begin{bmatrix} \frac{8}{5} \\ \frac{5}{2} \\ 1 \end{bmatrix} \\ Eigenvector\ is\ \begin{bmatrix} \frac{8}{5} \\ \frac{5}{2} \\ 1 \end{bmatrix} \]

\[ \lambda=4 \]

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

The reduced row echelon form of the matrix is

\[ \begin{bmatrix} 1 & -\frac{2}{3} & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix} \]

Finding the null space will give us eigenvector

\[ \begin{bmatrix} 1 & -\frac{2}{3} & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} x1 \\ x2 \\ x3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \]

\[ x1 = \frac{2}{3}x2,\ x3=0,\ x2\ is\ free\ variable \\ Thus, Null\ Space = x2\begin{bmatrix} \frac{2}{3} \\ 1 \\ 0 \end{bmatrix} \\ Eigenvector\ is\ \begin{bmatrix} \frac{2}{3} \\ 1 \\ 0 \end{bmatrix} \]

\[ \lambda=1 \]

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

The reduced row echelon form of the matrix is

\[ \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix} \]

Finding the null space will give us eigenvector

\[ \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} x1 \\ x2 \\ x3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \]

\[ x2 = 0,\ x3=0,\ x1\ is\ free\ variable \\ Thus, Null\ Space = x1\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \\ Eigenvector\ is\ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \]

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
result <- eigen(C)
eigenvalues <- result$values
cat("Eigenvalues:\n")
## Eigenvalues:
print(eigenvalues)
## [1] 6 4 1
eigenvectors <- result$vectors
cat("Eigenvectors:\n")
## Eigenvectors:
print(eigenvectors)
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0