library(pracma)

Problem 1.1

What is the rank of the matrix A?

To answer this question I am going to convert A into it’s reduced row echelon form. I worked this out on paper, but instead of writing each step out here I will use the useful R funciton rref(). The number of pivot columns will inform us of the rank.

A <- matrix(c(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3), nrow = 4, ncol = 4)
A <- t(A)
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

The reduced row echelon form shows 4 pivot columns, so the rank of A is 4.

rref_A <- rref(A)
rref_A
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    0
## [2,]    0    1    0    0
## [3,]    0    0    1    0
## [4,]    0    0    0    1

Problem 1.2

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

For this problem I am going to write out a 4x2 matrix named T.

T <- matrix(c(1,2,3,4,5,6,7,8), nrow = 2, ncol = 4)
T <- t(T)
T
##      [,1] [,2]
## [1,]    1    2
## [2,]    3    4
## [3,]    5    6
## [4,]    7    8

Since we just want the hypothetical maximum I am not going to take the rref, but let’s assume we took the rref of T. Below is what it could possibly looks like. Notice that we only have 2 pivot columns: so the maximum rank for an m x n matrix where m > n is n. The maximum rank would m if m < n. The minimum rank in this case would be 1 assuming the values are non zero.

rref_T <- matrix(c(1,0,0,1,0,0,0,0), nrow = 2, ncol = 4)
rref_T <- t(rref_T)
rref_T
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1
## [3,]    0    0
## [4,]    0    0

Problem 1.3

What is the rank of matrix B?

Matrix B is interesting becase each row is a multiple of each other. R2 = 3 * R1, R3 = 2 * R1.

B <- matrix(c(1,3,2,2,6,4,1,3,2), nrow = 3, ncol = 3)
B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2

If we divide row 2 by 3 and row 3 by 2 we get the matrix below.

B <- matrix(c(1,1,1,2,2,2,1,1,1), nrow = 3, ncol = 3)
B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    1    2    1
## [3,]    1    2    1

Now let’s look at the rref. Based on this we can say the rank is 1 for B.

rref_B <- rref(B)
rref_B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0

Problem 2

Compute the eigenvalues and eigenvectors of the matrix A

A <- matrix(c(1,0,0,2,4,0,3,5,6), nrow = 3, ncol = 3)
A
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    4    5
## [3,]    0    0    6

First we set up the determinant to solve for the eigen values.

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

First lets combine the 2 matrices

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

To solve the determinant we will use the rule of Sarrus to give the following function below. It actually works out because most of the values 0 out.

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

The polynomial comes out to be

\[\lambda^{3}-11\lambda^{2}+34\lambda-24\] \[\lambda = 1, 4, 6\] Now we need to find our eigen vectors. To do that we assume the function below. Where v is the vector we solve for. I will go through each of the three eigen values.

\[(\lambda*I_{n}-A)*v=0\]

Where lambda = 1

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

We will get this into reduced row echelon form first

A <- matrix(c(0,0,0,-2,-3,0,-3,-5,-5), nrow = 3, ncol = 3)
rref(A)
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2,]    0    0    1
## [3,]    0    0    0

\[\begin{bmatrix} 0&1&0 \\ 0&0&1 \\ 0&0&0 \\ \end{bmatrix}*\begin{bmatrix} v_{1} \\ v_{2} \\ v_{3} \\ \end{bmatrix} = 0\]

\[v_{1} = t, v_{2}=0, v_{3}=0\] So the eigen space then becomes \[E_{\lambda=1} = span(\begin{bmatrix}1\\0\\0 \end{bmatrix})\]

Now lets check when lambda = 4

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

A <- matrix(c(3,0,0,-2,0,0,-3,-5,-2), nrow = 3, ncol = 3)
rref(A)
##      [,1]       [,2] [,3]
## [1,]    1 -0.6666667    0
## [2,]    0  0.0000000    1
## [3,]    0  0.0000000    0

\[\begin{bmatrix} 1&-2/3&0 \\ 0&0&1 \\ 0&0&0 \\ \end{bmatrix}*\begin{bmatrix} v_{1} \\ v_{2} \\ v_{3} \\ \end{bmatrix} = 0\]

\[v_{1} = 2/3 * v_{2} = t\] \[v_{3} = 0\]

So the eigen space then becomes \[E_{\lambda=4} = span(\begin{bmatrix}2/3\\1\\0 \end{bmatrix})\]

Now lets check when lambda = 6

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

A <- matrix(c(5,0,0,-2,2,0,-3,-5,0), nrow = 3, ncol = 3)
rref(A)
##      [,1] [,2] [,3]
## [1,]    1    0 -1.6
## [2,]    0    1 -2.5
## [3,]    0    0  0.0

\[\begin{bmatrix} 1&0&-1.6 \\ 0&1&-2.5 \\ 0&0&0 \\ \end{bmatrix}*\begin{bmatrix} v_{1} \\ v_{2} \\ v_{3} \\ \end{bmatrix} = 0\]

\[ v_{1} = 1.6 * v_{3}, v_{2} = 2.5 * v_{3}, v_{3} =t \]

\[E_{\lambda=6} = span(\begin{bmatrix}1.6\\2.5\\1 \end{bmatrix})\]