Problem Set 1)
The rank of a matrix is defined as the number of linearly independent rows or linearly independent columns in a matrix A https://stattrek.com/matrix-algebra/matrix-rank.aspx
The process for computing the rank involves translating a matrix into echelon form. Putting this matrix into echelon form will be a tedious process but we will go through each and every step.
Add the first row to the second row \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \end{bmatrix} \]
Add -5 times row 1 to row 4 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 1 & -2 & 1 \\ 0 & -6 & -17 & -23 \end{bmatrix} \] Divide row 2 by 2 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 7/2 \\ 0 & 1 & -2 & 1 \\ 0 & -6 & -17 & -23 \end{bmatrix} \]
subtract the second row from the first row \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 7/2 \\ 0 & 0 & -4 & -5/2 \\ 0 & -6 & -17 & -23 \end{bmatrix} \]
6 times row 2 plus row 4 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 7/2 \\ 0 & 0 & -4 & -5/2 \\ 0 & 0 & -5 & -2 \end{bmatrix} \]
Divide row 3 by -4 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 7/2 \\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & -5 & -2 \end{bmatrix} \]
5 times row 3 plus row 4 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 7/2 \\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & 0 & 9/8 \end{bmatrix} \]
divide row 4 by 9/8 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 7/2 \\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
Add -5/8 row 4 to row 3 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 7/2 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
-7/2 row 4 plus row 2 \[ A=\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 2 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \] add-4 times row 1 to row 4 \[ A=\begin{bmatrix} 1 & 2 & 3 & 0 \\ 0 & 1 & 2 & 7/2 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
-2 times row 3 plus row 2 \[ A=\begin{bmatrix} 1 & 2 & 3 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \] We can bundle the next row operations since rows 2-4 will remain unchanged -3 times row 3 to row 1 -2 times row 2 plus row 1 \[ A=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
The rank of matrix A is 4 since there are 4 non zero linearly independent rows
Verify using r
A <- matrix(c(1,2,3,4,-1,0,1,3,0,1,-2,1,5,4,-2,-3), 4, 4, byrow=TRUE)
#A;
qr(A)$rank
## [1] 4
Answer Confirmed
We know that let Ra = rank of matrix A, where matrix A is an m x n matrix and m>n \[ Ra\le \{ min(row\_ rank,column\_ rank)\\Ra\le \{min(m,n)\} \] We know the maximum rank will be n and since the matrix is non_zero,then \[ Ra\le n\\Ra\ge 1 \] Thus the minimum rank of matrix A would be 1
-3 times row 1 plus row 2 \[ B=\begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 2 & 4 & 2 \end{bmatrix} \]
-2 times row 1 plus row 3 \[ B=\begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix} \] The rank of matrix B is 1, lets verify with R
B <- matrix(c(1,2,1,3,6,3,2,4,2), 3, 3, byrow=TRUE)
#A;
qr(B)$rank
## [1] 1
answer confirmed
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} \]
I previously wrote a template to compute the eigen values and eigen vectors for my week 3 discussion. We will follow the process outlined in that template https://rpubs.com/vharo00/418686
We will need the following formulas \[ Ax=\lambda x\\det(A-I\lambda)=0 \]
\[ A-I\lambda\\ det(\begin{bmatrix} 1-\lambda & 2 & 3 \\ 0 & 4-\lambda & 5 \\ 0 & 0 & 6-\lambda \end{bmatrix})=0 \]
Compute a determinant for a 3x3 matrix https://www.mathsisfun.com/algebra/matrix-determinant.html
Simplify the determinant and solve for lambda to find the characteristic polynomial. Solve for the roots of the polynomials to obtain the eigen values \[ (1- \lambda)((4- \lambda)(6-\lambda))+2(0-0)+3(0-0)=0\\ (1- \lambda)(4-\lambda)(6-\lambda)-0+0=0\\ (1-\lambda)(24-4\lambda-6\lambda+\lambda^{2})=0\\ (1-\lambda)(24-10\lambda+\lambda^{2})=0\\ 24-10\lambda+\lambda^{2}-24\lambda+10\lambda^{2}-\lambda^{3}=0\\ -\lambda^{3}+11\lambda^{2}-34\lambda+24=0 \] Lets make the leading term positive by dividing every term on the left and right side of the equation by a nergative one. please note that we also re-ordered each term such that the equation is in degree desc format \[ \lambda^{3}-11\lambda^{2}+34\lambda-24=0 \] We need to use factoring techniques to solve for the root of each equation. You may use newton method or bisection method is you want to approximate the roots but that is for a later time. For now: http://web.math.ucsb.edu/~vtkala/2016/S/4B/FactoringCubicPolynomials.pdf
Apply factoring by grouping ? \[ (\lambda^{3}-11\lambda^2)+(34\lambda-24)=0\\ \lambda^{2}(\lambda-11)+2(17\lambda-12)=0 \] Factoring by gouping did not work.
It seems that we should use the factorization theorem in order to factor our characteristic equation. This is a more involved process usually introduced in intro college algebra. For now, we will use R to find the roots.
Lets use R to verify our characteristic polynomial
A <- matrix(c(1,2,3,0,4,5,0,0,6), 3, 3, byrow=TRUE)
library(pracma)
## Warning: package 'pracma' was built under R version 3.4.4
charpoly(A)
## [1] 1 -11 34 -24
We indeed have the correct characteristic equation
Lets use R to verify our eigenvalues
A <- matrix(c(1,2,3,0,4,5,0,0,6), 3, 3, byrow=TRUE)
e <- eigen(A)
values<-e$values
values
## [1] 6 4 1
The eigen values are: \[ \lambda=1\\ \lambda=4\\ \lambda=6 \]
We now need to compute a possible eigen vector for each value of lambda. Lets start where lamda=1 \[ A-1I\\ \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} \begin{bmatrix} x \\ y\\z \end{bmatrix}=\begin{bmatrix} 0 \\ 0 \\0\end{bmatrix} \] We can re-write the matrix and then perform row operations \[ \begin{bmatrix} 0 & 2 & 3 &0 \\ 0 & 3 & 5 & 0 \\ 0 &0& 5&0 \end{bmatrix} \]
Since the row reduction process is time consuming, I will simply state the order of row operations leading to the final matrix divide row 1 by 2 add -3 times row 1 to row 2 multiply row 2 by 2 add -5 times row 2 to row 3 add -3/2 times row 2 to row 1 \[ \begin{bmatrix} 0 & 1 & 0 &0 \\ 0 & 0 & 1 & 0 \\ 0 &0& 0&0 \end{bmatrix} \] We end up getting the equations \[ y=0\\z=0 \]
A eigen vector is (1,0,0) if x=1
Now for lambda =4 \[ A-4I\\ \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} \begin{bmatrix} x \\ y\\z \end{bmatrix}=\begin{bmatrix} 0 \\ 0 \\0\end{bmatrix} \] We can re-write as \[ \begin{bmatrix} -3 & 2 & 3 &0 \\ 0 & 0 & 5 & 0 \\ 0 &0& 2&0 \end{bmatrix} \] Row reduction operations are as follows divide row 1 by -3 divide row 2 by 5 -2 timesrow 2 plus row 3 row 2 plus row 1 \[ \begin{bmatrix} 1 & -2/3 & 0 &0 \\ 0 & 0 & 1 & 0 \\ 0 &0& 0&0 \end{bmatrix} \] We get \[ x-2/3y=0\\ z=0 \] We can re-write the first equation and solve. Lets pick values for x. If x is 1, then y is 3/2 \[ x=2/3y\\ \] An eigen vector for this value of lambda is (2/3,1,0) if y=1
We go through this process one more when lambda is 6 \[ A-6I\\ \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} \begin{bmatrix} x \\ y\\z \end{bmatrix}=\begin{bmatrix} 0 \\ 0 \\0\end{bmatrix} \]
re-write as \[ \begin{bmatrix} -5 & 2 & 3 &0 \\ 0 & -2 & 5 & 0 \\ 0 &0& 0&0 \end{bmatrix} \] divide row 1 by -5 divide row 2 by -2 2/5 times row 2 plus row 1 \[ \begin{bmatrix} 1 &0 & -8/5 &0 \\ 0 & 1 & -5/2 & 0 \\ 0 &0& 0&0 \end{bmatrix} \]
This yields \[ x-8/5z=0\\ y-5/2z=0 \]
solve each let z=1 \[ x=8/5z\\ \] let z=1 \[ y=5/2z\\ \]
an eigen vector is (8/5,5/2,1) if z=1
Lets accumulate our eigen vectors
When lambda=x \[ \lambda=1\\ e1=(1, 0, 0)\\\\ \lambda=4\\ e2=(2/3,1,0)\\\\ \lambda=6\\ e3=(8/5,5/2,1) \]
Does R agree with our results?
library(pracma)
A <- matrix(c(1,2,3,0,4,5,0,0,6), nrow=3, byrow = T)
A
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 4 5
## [3,] 0 0 6
matrix correct
charpoly(A)
## [1] 1 -11 34 -24
characteristic polynomial correct
e <- eigen(A)
e
## 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
eigen value and eigen vectors verified…please note columns go from lambda =6, lambda=4, then lambda=1