Problem Set 1

  1. What is the rank of the matrix A?

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

Solution:

If A is an m x n matrix, then the rank of A is the dimension of the column space.To do that we first row-reduce the matrix since that will help us determine bases for the null space and column space.From below, we see that the RREF matrix is a square identity matrix with 4 rows and 4 columns. Here the number of dependent or “enslaved” columns is 4.D = {1,2,3,4}, For each index in D, theorem BCS creates a single basis vector. In total, the basis will have 4 vectors, so the column space of A will have the dimension 4 and we write r(A) = 4. This is shown below by the r function called matrix.rank which returns the rank of a square numeric matrix.

library(matrixcalc)
library(pracma)
## Warning: package 'pracma' was built under R version 3.6.3
A <- matrix(data = c(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3), nrow = 4, ncol = 4, byrow = TRUE); print(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
r_matrix <- rref(A); print(r_matrix)
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    0
## [2,]    0    1    0    0
## [3,]    0    0    1    0
## [4,]    0    0    0    1
ra <- matrix.rank(r_matrix)
sprintf("The rank of matrix A is: %d", ra)
## [1] "The 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?

Solution:

Per theorem CRN, if r denotes the number of pivot columns (or non-zero rows), then r(A) = r. As we saw with the example above, if the number of non-zero rows is the maximum number of rows, then the rank equals the number of rows of the mxn matrix. So, the maximum rank r(A) = m. The minimum rank could be 1.

  1. What is the rank of matrix B?

Solution:

\[\begin{equation*} B = \begin{pmatrix} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \end{pmatrix} \end{equation*}\]

As we did before, reduce matrix B to Reduced-row Echelon Form (RREF). We see it has only one non-zero row from below, hence the rank is 1.This can be found using the R function matrix.rank as we previously employed in problem set 1.

##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0
## [1] "The rank of matrix B is: 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 poynomial and show your solution.

\[\begin{equation*} A = \begin{pmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{pmatrix} \end{equation*}\]

Solution:

Here A is a square matrix of size 3. Then the characteristic polynomial of A is the polynomial p_A(x) defined by \[\begin{equation*} p_A(x) = det(A - x * I_3) \end{equation*}\]

where I_3 is the identity matrix of dimensions 3. Substituting the values of matrix A and x * I_3 into the RHS of the equation, we get below: \[\begin{equation*} p_A(x) = det(\begin{pmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{pmatrix} - \begin{pmatrix} x & 0 & 0 \\ 0 & x & 0 \\ 0 & 0 & x \end{pmatrix}) \end{equation*}\]

Simplifying the RHS into one matrix gives us below:

\[\begin{equation*} det(\begin{pmatrix} (1-x) & 2 & 3 \\ 0 & (4-x) & 5 \\ 0 & 0 & (6-x) \end{pmatrix}) = 0 \end{equation*}\]

For a 3x3 or higher-order matrix, we can solve the determinant as below:

\[\begin{equation*} (1 - x) * (\begin{pmatrix} (4-x) & 5 \\ 0 & (6-x) \end{pmatrix}) - 2 * (\begin{pmatrix} 0 & 5 \\ 0 & (6-x) \end{pmatrix}) + 3 * (\begin{pmatrix} 0 & (4-x) \\ 0 & 0 \end{pmatrix}) = 0 \end{equation*}\]

The above equation reduces to a single line below:

\[\begin{equation*} (1 - x) * (((4 - x) * (6 - x)) - (0 * 5)) - 2 * ((0 * (6 - x)) - (0 * 5)) + 3 * ((0 * 0) - (0 * (4 -x))) \end{equation*}\]

which further reduces to the factored form of the polynomial below and this equation is in effect our characteristic polynomial.

\[\begin{equation*} p_A(x) = (1 - x) * ((4 - x) * (6 - x)) \end{equation*}\]

Now for a square matrix A, lambda is an eigenvalue of A if and only if the below condition is satisfied, i.e., Eigenvalues of a matrix are roots of the characteristic polynomial, so we find the roots.

\begin{pmatrix} det(A - I_3) * x = 0\ \end{pmatrix}

Setting our characteristic polynomial equation to 0, we get the following roots -> x = 1, x = 4 and x = 6. By theorem EMRCP, we then get the eigenvalues below.

\[\begin{equation*} (\lambda = 1) \\ (\lambda = 4) \\ (\lambda = 6) \end{equation*}\]

Now, solving for Eigen vectors.

\[\begin{pmatrix} v * (A - I * \lambda) = 0\\ \end{pmatrix}\]

When Eigenvalue = 1, \[\begin{equation*} (\begin{pmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{pmatrix} - \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}) * \begin{pmatrix} v1 \\ v2 \\ v3 \end{pmatrix} = 0 \end{equation*}\]

OR

\[\begin{equation*} (\begin{pmatrix} 0 & 2 & 3 \\ 0 & 3 & 5 \\ 0 & 0 & 5 \end{pmatrix} * \begin{pmatrix} v1 \\ v2 \\ v3 \end{pmatrix}) = 0 \end{equation*}\]

Written as a system of equations as shown in the weekly reading pdf, we get:

\[\begin{equation*} 5 * v_3 = 0\\ v_3 = 0 \\ 3 * v_2 + 5 * v_3 = 0\\ v_3 = 0 -> v_2 = 0\\ v_1 = 1 \end{equation*}\]

The Eigenvectors for Eigenvalue = 1 are \[\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}\]

When Eigenvalue = 4, \[\begin{equation*} (\begin{pmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{pmatrix} - \begin{pmatrix} 4 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & 4 \end{pmatrix}) * \begin{pmatrix} v1 \\ v2 \\ v3 \end{pmatrix} = 0 \end{equation*}\]

OR

\[\begin{equation*} (\begin{pmatrix} -3 & 2 & 3 \\ 0 & 0 & 5 \\ 0 & 0 & 2 \end{pmatrix} * \begin{pmatrix} v1 \\ v2 \\ v3 \end{pmatrix}) = 0 \end{equation*}\]

Written as a system of equations as shown in the weekly reading pdf, we get:

\[\begin{equation*} 2 * v_3 = 0\\ v_3 = 0 \\ -3 * v_1 + 2 * v_2 = 0\\ v_1 = 2/3 * v_2 \\ v_2 = 1 \end{equation*}\]

The Eigenvectors for Eigenvalue = 4 are \[\begin{pmatrix} 2/3 \\ 1 \\ 0 \end{pmatrix}\]

When Eigenvalue = 6, \[\begin{equation*} (\begin{pmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{pmatrix} - \begin{pmatrix} 6 & 0 & 0 \\ 0 & 6 & 0 \\ 0 & 0 & 6 \end{pmatrix}) * \begin{pmatrix} v1 \\ v2 \\ v3 \end{pmatrix} = 0 \end{equation*}\]

OR

\[\begin{equation*} (\begin{pmatrix} -5 & 2 & 3 \\ 0 & -2 & 5 \\ 0 & 0 & 0 \end{pmatrix} * \begin{pmatrix} v1 \\ v2 \\ v3 \end{pmatrix}) = 0 \end{equation*}\]

Written as a system of equations as shown in the weekly reading pdf, we get:

\[\begin{equation*} (-2 * v_2) + (5 * v_3) = 0\\ v_2 = 5/2 * v_3 \\ -5 * v_1 + 2 * v_2 + 3 * v_3 = 0\\ 5 * v_1 = 8 * v_3 \\ v_1 = 8/5 \end{equation*}\]

The Eigenvectors for Eigenvalue = 6 are \[\begin{pmatrix} 8/5 \\ 5/2 \\ 1 \end{pmatrix}\]

The manually derived values above are confirmed through the use of the R function below.

library(pracma)
A <- matrix(c(1,2,3,0,4,5,0,0,6), 3, 3, byrow=TRUE); A
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    4    5
## [3,]    0    0    6
I <- diag(3)
rref(A - I)
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2,]    0    0    1
## [3,]    0    0    0
rref(A - 4 * I)
##      [,1]       [,2] [,3]
## [1,]    1 -0.6666667    0
## [2,]    0  0.0000000    1
## [3,]    0  0.0000000    0
rref(A - 6 * I)
##      [,1] [,2] [,3]
## [1,]    1    0 -1.6
## [2,]    0    1 -2.5
## [3,]    0    0  0.0
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