Grando 3 Homework

1.1 What is the rank of the matrix A?

library(pracma)
A <- matrix(c(1, 2, 3, 4, -1, 0, 1, 3, 0, 1, -2, 1, 5, 4, -2, -3), nrow = 4, byrow = TRUE)
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

Anwer:

The rank of the 4x4 matrix is 4. This is an invertible matrix because the determinant is not zero (det(A) = -9) and the matrix is square. Therefore, as indicated by the reading, the rank of an invertible matrix is the same as the dimensions.

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?

Answer:

The maximum row rank of the matrix specifice is n. Since the rank is the number of linearly independendent columns, the maximum value can only be the number of columns in the matrix. For the minimum rank, as long as there is one non-zero entry, that row can be converted into a reduced row echelon form, meaning that there will be at least a rank of 1.

1.3 What is the rank of matrix B?

B <- matrix(c(1, 2, 1, 3, 6, 3, 2, 4, 2), nrow = 3, byrow = TRUE)
rref(B)
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0

Answer:

B is a square matrix and not invertible because the determinant is zero. Upon row reduction we find that the rank is 1 because rows/columns 2 and 3 are linear combinations of row/column 1.

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.

Answer:

Eigenvalues are determined by solving the following equation:

\[det\left( A-I\lambda \right) =0\]

Which, in this case, is:

\[det\left( \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} \right) =0\]

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

Which reduces to:

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

\[(1-\lambda )*((4-\lambda )*(6-\lambda )-5*0)-2*(0*(6-\lambda )-(5*0))+3*(0*0-(4-\lambda )*0)\]

\[(1-\lambda )*((4-\lambda )*(6-\lambda ))\]

\[(1-\lambda )*(24-4\lambda -6\lambda +{ \lambda }^{ 2 })=(1-\lambda )*(24-10\lambda +{ \lambda }^{ 2 })\]

\[24-10\lambda +{ \lambda }^{ 2 }-24\lambda +10{ \lambda }^{ 2 }-{ \lambda }^{ 3 }=\\-{ \lambda }^{ 3 }+11{ \lambda }^{ 2 }-34{ \lambda }+24\]

\[(-x+1)(x-4)(x-6)\]

The eigenvalues are 1, 4, and 6. Actually, we see here that for the upper triangular matrix, we get the diagonal entries as eigenvalues. It seems like this would hold true for any scenario, but I wasn’t able to find a proof online so i’m skeptical this is always the result. Anyways, let’s test the answers and then get the eigenvectors:

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

eigenvector for \(\lambda\)=1:

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

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

For eigenvalue = 1, x2=x3=0, and since x1 was not in the equation, it can tak on any value. Therefore, the eigenvector is:

\[v=\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}\]

eigenvector for \(\lambda\)=4:

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

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

\[S=\begin{Bmatrix} 1x - \frac { 2 }{ 3 } y = 0 \\ z = 0 \end{Bmatrix}=\begin{Bmatrix} 1x=\frac { 2 }{ 3 } y \\ z = 0 \end{Bmatrix}\]

v = c(2/3, 1, 0)
(v_unit = v/sqrt(sum(v^2)))
## [1] 0.5547002 0.8320503 0.0000000

\[v=\begin{pmatrix} 0.555 \\ 0.832 \\ 0 \end{pmatrix}\]

eigenvector for \(\lambda\)=6:

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

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

\[S=\begin{Bmatrix} x-1.6z=0 \\ y-2.5z=0 \end{Bmatrix}=\begin{Bmatrix} x=1.6z \\ y=2.5z \end{Bmatrix}=\begin{Bmatrix} x=1.6 \\ y=2.5 \end{Bmatrix}\]

v = c(1.6, 2.5, 1)
(v_unit = v/sqrt(sum(v^2)))
## [1] 0.5108407 0.7981886 0.3192754

\[v=\begin{pmatrix} 0.511 \\ 0.798 \\ 0.319 \end{pmatrix}\]