DATA605 - Assignment 3

Nick Oliver

IS 605 FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS - 2014

  1. 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} \]

Convert A to RREF

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

Rank is 4. There are no linear independent rows

A = matrix(c(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3),nrow=4,byrow = TRUE)
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
pracma::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
Matrix::rankMatrix(A)
## [1] 4
## attr(,"method")
## [1] "tolNorm2"
## attr(,"useGrad")
## [1] FALSE
## attr(,"tol")
## [1] 8.881784e-16
  1. Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

The maximum rank would be m as it is possible as in problem set one that no rows are linearly independent. The minimum rank is 1

  1. What is the rank of matrix B? \[ B = \begin{bmatrix} 1&2&1\\ 3&6&3\\ 2&4&2 \end{bmatrix} \]

Convert B to reduced row echelon form. Count number of non-zero rows

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

B = matrix(c(1,2,1,3,6,3,2,4,2),nrow=3,byrow=TRUE)
B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
pracma::rref(B)
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0
Matrix::rankMatrix(B)
## [1] 1
## attr(,"method")
## [1] "tolNorm2"
## attr(,"useGrad")
## [1] FALSE
## attr(,"tol")
## [1] 6.661338e-16
  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} \]

\[ \lambda I_3 = \begin{bmatrix} \lambda & 0 & 0 \\ 0 & \lambda & 0 \\ 0 & 0 & \lambda \end{bmatrix} \]

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

Apply rule of Sarrus

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

\[ (\lambda-1 )(\lambda-4)(\lambda-6) + (-2)(-5)(0) + (-3)(0)(0) - (-2)(0)(\lambda-6) - (\lambda-1)(-5)(0) - (-3)(\lambda-4)(0) \] Everything drops out except the first terms \[ (\lambda-1 )(\lambda-4)(\lambda-6) \] This leaves us with three eigenvalues \[\lambda = 1\] \[\lambda = 4\] \[\lambda = 6\]

Eigenvector for \[\lambda = 1\]

Plug value in for lambda

\[ \lambda I_3 = - A = \begin{bmatrix} 0 & -2 & -3 \\ 0 & -3 & -5 \\ 0 & 0 & -5 \end{bmatrix} \xrightarrow{RREF} \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1\\v_2\\v_3 \end{bmatrix} = \begin{bmatrix} 0\\0\\0 \end{bmatrix} \\ v_1 = t\\ v_2 = 0\\ v_3 = 0 \\ E_1 = t \begin{bmatrix}1\\0\\0\end{bmatrix} \]

Eigenvector for \[\lambda = 4\]

Plug value in for lambda

\[ \lambda I_3 = - A = \begin{bmatrix} 3 & -2 & -3 \\ 0 & 0 & -5 \\ 0 & 0 & 2 \end{bmatrix} \xrightarrow{RREF} \begin{bmatrix} 1 & 2/3 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1\\v_2\\v_3 \end{bmatrix} = \begin{bmatrix} 0\\0\\0 \end{bmatrix} \\ v_1 + 2/3v_2 = 0 \\ v_3 = 0 \]


Eigenvector for \[\lambda = 6\]

Plug value in for lambda

\[ \lambda I_3 = - A = \begin{bmatrix} 5 & -2 & -3 \\ 0 & 2 & -5 \\ 0 & 0 & 0 \end{bmatrix} \xrightarrow{RREF} \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} = \begin{bmatrix} 0\\0\\0 \end{bmatrix} \\ v_1 - 1.6v_3 = 0 \rightarrow 0.625v_1 = v_3\\ v_2 - 2.5v_3 = 0 \rightarrow 0.4v_2 = v_3 \\ v_3 = t \\ E_6 = t \begin{bmatrix} 0.625\\0.4\\0\end{bmatrix} \]

A = matrix(c(1,2,3,0,4,5,0,0,6),nrow=3,byrow=TRUE)
A
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    4    5
## [3,]    0    0    6
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
B = matrix(c(0,-2,-3,0,-3,-5,0,0,-5),nrow=3,byrow=TRUE)
B
##      [,1] [,2] [,3]
## [1,]    0   -2   -3
## [2,]    0   -3   -5
## [3,]    0    0   -5
pracma::rref(B)
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2,]    0    0    1
## [3,]    0    0    0
C = matrix(c(3,-2,-3,0,0,-5,0,0,0),nrow=3,byrow=TRUE)
C
##      [,1] [,2] [,3]
## [1,]    3   -2   -3
## [2,]    0    0   -5
## [3,]    0    0    0
pracma::rref(C)
##      [,1]       [,2] [,3]
## [1,]    1 -0.6666667    0
## [2,]    0  0.0000000    1
## [3,]    0  0.0000000    0
D = matrix(c(5,-2,-3,0,2,-5,0,0,0),nrow=3,byrow=TRUE)
D
##      [,1] [,2] [,3]
## [1,]    5   -2   -3
## [2,]    0    2   -5
## [3,]    0    0    0
pracma::rref(D)
##      [,1] [,2] [,3]
## [1,]    1    0 -1.6
## [2,]    0    1 -2.5
## [3,]    0    0  0.0