#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}\]

Replace R2 with the sum of R1 and R2: \[A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7\\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \\ \end{bmatrix}\]

Subtract 5 times R1 from R4: \[A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7\\ 0 & 1 & -2 & 1 \\ 0 & -6 & -17 & -23 \\ \end{bmatrix}\]

Multiply R3 by 2 and subtract R2:

\[A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7\\ 0 & 0 & -8 & -5 \\ 0 & -6 & -17 & -23 \\ \end{bmatrix}\]

Multiply R2 by 3 and add it to R4:

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

Multiply R3 by 5 and R4 by -8 and add the results in R4: \[A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7\\ 0 & 0 & -8 & -5 \\ 0 & 0 & 0 & -41 \\ \end{bmatrix}\]

There are 4 non-zero rows, therefore the rank of the matrix is 4.

Check with R functions:

library(Matrix)

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

rank_value <- as.numeric(Matrix::rankMatrix(Matrix(A)))

print(rank_value)
## [1] 4

##2. Given an \(m \times n\) matrix where \(m > n\), what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

There are two extreme cases for a non-zero \(m \times n\) matrix where \(m > n\): a matrix in which \(n\) is 1 less than \(m\), i.e. \(m-n=1\), and a matrix in which \(n=1\), and \(m\) is any value greater than 2.

Example in which \(m-n=1\): \[ A=\begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \\ \end{bmatrix} \]

Subtract 3 times R1 from R2: \[ A=\begin{bmatrix} 1 & 2 \\ 0 & -2 \\ 5 & 6 \\ \end{bmatrix} \]

Subtract 5 times R1 from R3: \[ A=\begin{bmatrix} 1 & 2 \\ 0 & -2 \\ 0 & -4 \\ \end{bmatrix} \]

Subtract 2 times R2 from R3: \[ A=\begin{bmatrix} 1 & 2 \\ 0 & -2 \\ 0 & 0 \\ \end{bmatrix} \]

This example illustrates that when \(m-n=1\), you will always be able to zero out the mth row of the matrix, meaning that the maximum rank of the matrix would be \(m-1\), or \(n\).

Example in which \(n=1\):

\[ A=\begin{bmatrix} 1 \\ 3 \\ 5 \\ \end{bmatrix} \]

Subtract 3 times R1 from R2: \[ A=\begin{bmatrix} 1 \\ 0 \\ 5 \\ \end{bmatrix} \]

Subtract 5 times R1 from R3: \[ A=\begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} \]

Regardless of the number of rows in the matrix, it would be possible to continue zeroing out each row by subtracting a multiple of the first row, until only one non-zero row remains and the rank is 1.

Therefore, the maximum rank of a non-zero \(m \times n\) matrix where \(m > n\) is \(n\), and the minimum rank is 1.

##3. What is the rank of matrix \(B\)?

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

The rank of this matrix is 1, since all the rows are multiples of each other. Therefore it is possible to zero out all the rows except the first row in the following way:

Subtract 3 times R1 from R2:

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

Subtract 2 times R1 from R3:

\[ B=\begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix} \]

This example also makes it clear that for any matrix in which all the rows are multiples of each other, the rank is 1.

Check with R functions:

library(Matrix)

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

rank_value <- as.numeric(Matrix::rankMatrix(Matrix(B)))

print(rank_value)
## [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} \]

##Finding the eigenvalues \(\lambda\): \[det(A- \lambda I)=0\]

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

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

\[ \lambda = 1, 4, 6\]

It is not necessary to find the characteristic polynomial when solving for the eigenvalues since the determinant is already in factored form (which must happen with an upper triangular matrix,) but if we were to, as stated in the directions, it would be:

\[(4 + \lambda ^2 -5 \lambda)(6- \lambda) \] \[ - \lambda ^3 +11 \lambda ^2 -34 \lambda +24\]

##Finding the eigenvectors:

For \(\lambda = 1\)

\(A- \lambda I\)

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

\[ \begin{bmatrix} 0 & 2 & 3 \\ 0 & 3 & 5 \\ 0 & 0 & 5 \\ \end{bmatrix} \]

\[ \begin{bmatrix} 0 & 2 & 3 \\ 0 & 3 & 5 \\ 0 & 0 & 5 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ \end{bmatrix} =0 \]

\[ 2y+3z=0 \\ 3y+5z=0 \\ 5z=0 \]

\[ z=0 \\ 3y=0 \\ y=0 \\ \]

\(x\) can be any nonzero scalar, therefore: \[ v = \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} \]

For \(\lambda = 4\)

\(A- \lambda I\)

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

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

\[ \begin{bmatrix} -3 & 2 & 3 \\ 0 & 0 & 5 \\ 0 & 0 & 2 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ \end{bmatrix} =0 \]

\[ -3x+2y+3z=0 \\ 5z=0 \\ 2z=0 \\ z=0 \\ -3x+2y=0 \\ x= \frac 2 3 y\\ v = \begin{bmatrix} 2 \\ 3 \\ 0 \\ \end{bmatrix} \]

For \(\lambda = 6\)

\(A- \lambda I\)

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

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

\[ \begin{bmatrix} -5 & 2 & 3 \\ 0 & -2 & 5 \\ 0 & 0 & 0 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ \end{bmatrix} =0 \]

\[ -5x+2y+3z=0 \\ -2y+5z=0 \\ y= \frac 5 2 z\\ -5x+2(\frac 5 2 z)+3z=0 \\ x= \frac 8 5 z\\ \]

\(z\) can be any nonzero scalar, therefore: \[ v = \begin{bmatrix} 8/5 \\ 5/2 \\ 1 \\ \end{bmatrix} \]

Therefore,

The eigenvector associated with the eigenvalue 1 is \[ v = \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} \]

The eigenvector associated with the eigenvalue 4 is \[ v = \begin{bmatrix} 2 \\ 3 \\ 0 \\ \end{bmatrix} \]

The eigenvector associated with the eigenvalue 6 is \[ v = \begin{bmatrix} 8/5 \\ 5/2 \\ 1 \\ \end{bmatrix} \]

Check with R functions:

library(Matrix)

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

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