ASSIGNMENT 3 IS 605 FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS - 2014
#install.packages('pracma')
library(pracma)
library(matlib)
Note: Rank is equal to the number of non-zero rows in the reduced row echelon form (RREF). \[A=\begin{Bmatrix} 1 & 2 & 3 & 4\\ -1 & 0 & 1 & 3\\ 0 & 1 & -2 & 1\\ 5 & 4 & -2 & -3\\ \end{Bmatrix}\]
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
Rank = 4
Note: Rank is equal to the number of non-zero rows of a RREF matrix. For a rectangular matrix of the form m x n the max number of non-zero rows is equal the the smaller of the two(columns and rows) and in this case is equal to n.
For a non zero matrix, the minimum rank is atleast 1.
\[B = \begin{Bmatrix} 1 & 2 & 1\\ 3 & 6 & 3\\ 2 & 4 & 2\\ \end{Bmatrix}\]
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
Rank = 1. There is only one non zero row.
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}\]
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
Step by step solution: Note: For a triangular matrix the eigenvalues are the values of its diagonal.
eigen(A)$values
## [1] 6 4 1
\[Thus: \lambda_1=1 , \lambda_2=4 and \lambda_3=6\]
The characteristic polynomial takes the form: \[pA(\lambda)=(1-\lambda)(4-\lambda(6-\lambda)\]
and thus:
\[pA(\lambda)=24-34\lambda+11\lambda^2-\lambda^3\]
lets take a case of
\[\lambda=1\]
then
\[A-1I_3\]
row-reduces to:
rref(A - 1*diag(3))
## [,1] [,2] [,3]
## [1,] 0 1 0
## [2,] 0 0 1
## [3,] 0 0 0
in this case set the matrix vector product to equal zero vector. \[\begin{pmatrix} 0&1&0\\ 0&0&1\\ 0&0&0\\ \end{pmatrix} \begin{pmatrix} x_1\\ x_2\\ x_3\\ \end{pmatrix} = \begin{pmatrix} 0\\ 0\\ 0\\ \end{pmatrix}\]
where if:
\[\lambda = 4\] Then: \[A - 4I_3\]
row reduces to: See R computation below
rref(A - 4 * diag(3))
## [,1] [,2] [,3]
## [1,] 1 -0.6666667 0
## [2,] 0 0.0000000 1
## [3,] 0 0.0000000 0
Now solve for:
\[x_1, x_2 and x_3\]
\[\begin{pmatrix} 1& \frac{-2}{3} &0\\ 0&0&1\\ 0&0&0\\ \end{pmatrix} \begin{pmatrix} x_1\\ x_2\\ x_3\\ \end{pmatrix} = \begin{pmatrix} 0\\ 0\\ 0\\ \end{pmatrix}\]
Solution: \[x_1 = 2/3, x_2 = 0 and x_3 = 0\]
the eigenspace is thus
\[E_{\lambda=4}=\begin{Bmatrix} 1\\ 1.5\\ 0\\ \end{Bmatrix}\] Repeat the step above:
For:
\[\lambda = 6\]
Then:
\[A - 6I_3\]
row reduces to: See R computation below
#rref(A - 6 * diag(3))
b = c(0,0,0)
echelon((A - 6 * diag(3)), b, reduced=TRUE, verbose=TRUE, fractions=TRUE)
##
## Initial matrix:
## [,1] [,2] [,3] [,4]
## [1,] -5 2 3 0
## [2,] 0 -2 5 0
## [3,] 0 0 0 0
##
## row: 1
##
## multiply row 1 by -1/5
## [,1] [,2] [,3] [,4]
## [1,] 1 -2/5 -3/5 0
## [2,] 0 -2 5 0
## [3,] 0 0 0 0
##
## row: 2
##
## multiply row 2 by -1/2
## [,1] [,2] [,3] [,4]
## [1,] 1 -2/5 -3/5 0
## [2,] 0 1 -5/2 0
## [3,] 0 0 0 0
##
## multiply row 2 by 2/5 and add to row 1
## [,1] [,2] [,3] [,4]
## [1,] 1 0 -8/5 0
## [2,] 0 1 -5/2 0
## [3,] 0 0 0 0
##
## row: 3
Now solve for:
\[x_1, x_2 and x_3\]
\[\begin{Bmatrix} 1 & 0 & -1.6\\ 0 & 1 & -2.5\\ 0 & 0 & 0\\ \end{Bmatrix} \begin{Bmatrix} x_1\\ x_2\\ x_3\\ \end{Bmatrix} = \begin{Bmatrix} 0\\ 0\\ 0\\ \end{Bmatrix}\]
Solution: \[x_1 = 1.6, x_2 = 2.5 and x_3 = 1\]
for lambda = 6 the eigenvector is
\[E_{\lambda=6}= \begin{Bmatrix} 1.6\\ 2.5\\ 1\\ \end{Bmatrix}\] *** The same applies to the case of lambda = 1. Please show your work using an R-markdown document. Please name your assignment submission with your first initial and last name.***
*** See problem set 2 by hand calculation.***