Problem Set 1

What is the rank of matrix \(A\)?

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

Solution by Hand

Reduced Echelon Form:

\[ \begin{bmatrix} 1 & 2 & 3 & 4\\ -1 & 0 & 1 & 3\\ 0 & 1 & -2 & 1\\ 5 & 4 & -2 & -3\\ \end{bmatrix} \rightarrow R2 = R1 + R2, R4 = R4-5R1 \rightarrow \begin{bmatrix} 1 & 2 & 3 & 4\\ 0 & 2 & 4 & 7\\ 0 & 1 & -2 & 1\\ 0 & -6 & -17 & -23\\ \end{bmatrix}\\ \rightarrow R3 = -2R3 + R2 \rightarrow \begin{bmatrix} 1 & 2 & 3 & 4\\ 0 & 2 & 4 & 7\\ 0 & 0 & 8 & 5\\ 0 & -6 & -17 & -23\\ \end{bmatrix} \rightarrow R4 = 3R2 + R4 \rightarrow \begin{bmatrix} 1 & 2 & 3 & 4\\ 0 & 2 & 4 & 7\\ 0 & 0 & 8 & 5\\ 0 & 0 & -5 & -2\\ \end{bmatrix} \rightarrow \\ \rightarrow R3 = R3/8 \rightarrow \begin{bmatrix} 1 & 2 & 3 & 4\\ 0 & 2 & 4 & 7\\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & -5 & -2\\ \end{bmatrix} \rightarrow R4 = 5R3 + R4 \rightarrow \begin{bmatrix} 1 & 2 & 3 & 4\\ 0 & 2 & 4 & 7\\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & 0 & 9/8\\ \end{bmatrix} \]

Since there are four non-zero rows, the rank is 4.

Solution with R

a <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3), ncol = 4, nrow = 4)

qr(a)$rank
## [1] 4

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

Solution

The maximum rank would be n and, given that the matrix is non-zero, the minimum rank would be n.

What is the rank of matrix \(B\)?

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

Solution by Hand

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

There is one non-zero row, so the rank is 1.

Solution with R

b <- matrix(c(1,3,2,2,6,4,1,3,2), ncol = 3, nrow = 3)

qr(b)$rank
## [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.

Solution by Hand

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

Hence, the eigenvalues are \(\lambda_1 = 1\), \(\lambda_2 = 4\), and \(\lambda_3 = 6\).

Now, we’ll solve for the eigenvectors using the following: \[ (A - \lambda I)x = 0 \]

First, we’ll start with \(\lambda_1 = 1\):

\[ A - \lambda I = \begin{bmatrix} 1 - 1 & 2 & 3\\ 0 & 4-1 & 5\\ 0 & 0 & 6-1\\ \end{bmatrix} = \begin{bmatrix} 0 & 2 & 3\\ 0 & 3 & 5\\ 0 & 0 & 5\\ \end{bmatrix} \rightarrow R1 = 2R2-3R1 \rightarrow \\ \rightarrow \begin{bmatrix} 0 & 2 & 3\\ 0 & 0 & 1\\ 0 & 0 & 5\\ \end{bmatrix} \rightarrow R3 = R3-5R2 \rightarrow \begin{bmatrix} 0 & 2 & 3\\ 0 & 0 & 1\\ 0 & 0 & 0\\ \end{bmatrix} \rightarrow R1 = R1 - 3R2 \rightarrow\\ \begin{bmatrix} 0 & 2 & 0\\ 0 & 0 & 0\\ 0 & 0 & 0\\ \end{bmatrix} \rightarrow R1 = R1/2 \rightarrow \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\\ \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ \end{bmatrix}\\ x_1 = t, x_2 =0, x_3=0\\ v_1 = \begin{bmatrix} 1\\ 0\\ 0\\ \end{bmatrix} \]

Now, we’ll find the eigenvector for \(\lambda_2 = 4\).

\[ (A - \lambda I) = \begin{bmatrix} 1-4 & 2 & 3\\ 0 & 4-4 & 5\\ 0 & 0 & 6-4\\ \end{bmatrix} \rightarrow \begin{bmatrix} -3 & 2 & 3\\ 0 & 0 & 5\\ 0 & 0 & 2\\ \end{bmatrix} \rightarrow R3 = 5R3 - 2R2 \rightarrow \\ \begin{bmatrix} -3 & 2 & 3\\ 0 & 0 & 5\\ 0 & 0 & 0\\ \end{bmatrix} \rightarrow R1 = 5R1-3R2 \rightarrow \begin{bmatrix} -3 & 2 & 0 \\ 0 & 0 & 1\\ 0 & 0 & 0\\ \end{bmatrix} \rightarrow R1 = -R1/3 \rightarrow \begin{bmatrix} 1 & -2/3 & 0 \\ 0 & 0 & 1\\ 0 & 0 & 0\\ \end{bmatrix}\\ \begin{bmatrix} 1 & -2/3 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\\ \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ \end{bmatrix} = 0\\ x_2 = t, x_1 = 2t/3, x_3 = 0\\ v_2 = \begin{bmatrix} 2/3\\ 1\\ 0\\ \end{bmatrix} \]

Lastly, we will find the eigenvector associated with \(\lambda_3 = 6\).

\[ (A - \lambda I) = \begin{bmatrix} 1-6 & 2 & 3 \\ 0 & 4-6 & 5\\ 0 & 0 & 6-6\\ \end{bmatrix} \rightarrow \begin{bmatrix} -5 & 2 & 3 \\ 0 & -2 & 5 \\ 0 & 0 & 0 \\ \end{bmatrix} \rightarrow R1 = R1 + R2 \rightarrow \\ \begin{bmatrix} -5 & 0 & 8 \\ 0 & -2 & 5 \\ 0 & 0 & 0\\ \end{bmatrix} \rightarrow R1 = -R1/5, R2 = -R2/2 \rightarrow \begin{bmatrix} 1 & 0 & -8/5\\ 0 & 1 & -5/2\\ 0 & 0 & 0 \\ \end{bmatrix} \\ \begin{bmatrix} 1 & 0 & -8/5\\ 0 & 1 & -5/2\\ 0 & 0 & 0 \\ \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ \end{bmatrix} =0\\ x_1 = 8t/5, x_2 = 5t/2, x_3 = t\\ v_3 = \begin{bmatrix} 8/5 \\ 5/2 \\ 1 \\ \end{bmatrix} \]

Solution with R

a = matrix(c(1,0,0,2,4,0,3,5,6), ncol = 3, nrow = 3)

# find eigenvalues and eigenvectors
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