Problem 1: Find the Rank of matrix A
\(A= \begin{bmatrix} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \\ \end{bmatrix}\)
To find the rank will have to reduce the matrix to row-echelon form and the number of pivots will be equal to the rank of the matrix
\[ R_2 = R_1+R_2 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \\ \end{bmatrix} -> R_2= 3*R_3 - R_2 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & -10 & -4 \\ 0 & 1 & -2 & 1 \\ 5 & 4 & -2 & -3 \\ \end{bmatrix} \]
\[ R_3 = R_2-R_3 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & -10 & -4 \\ 0 & 0 & -8 & -5 \\ 5 & 4 & -2 & -3 \\ \end{bmatrix} -> R_4=5R_1 - R_4 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & -10 & -4 \\ 0 & 0 & -8 & -5 \\ 0 & 6 & 17 & 23 \\ \end{bmatrix} \]
\[ R_4=6*R_2-R_4 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & -8 & -5 \\ 0 & 0 & -77 & -47 \\ \end{bmatrix} -> R_3=-(1/8)*R_3 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & -77 & -47 \\ \end{bmatrix} \]
\[ R_4=77*R_3+R_4 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & 0 & 9/8 \\ \end{bmatrix} -> R_4 = (8/9)*R_4 \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 1 & 6 & 6 \\ 0 & 0 & 1 & 5/8 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \]
After reducing to row-echelon form we can count 4 pivots and therefore the rank of this matrix is 4
Problem 2:
Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero? \subsection The maximum rank that this matrix can have will be equal to n. This is because the max rank of a matrix is equal to the smaller of the two dimensions of the matrix and in this case that is equal to n.
The minimum rank, assuming the matrix is non-zero, would be 1. This is because if the matrix is non-zero, there must be at least one non-zero element in the matrix. This means that there must be at least one linearly independent row or column and therefore the rank must be at least 1.
Problem 3:
Find the Rank of matrix B
\(B= \begin{bmatrix} 1 & 2 & 1 \\ 3 & 6 & 3 \\ 2 & 4 & 2 \\ \end{bmatrix}\)
To find the rank will have to reduce the matrix to row-echelon form and the number of pivots will be equal to the rank of the matrix.
\[ R_2=3*R_1-R_2 \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 2 & 4 & 2 \\ \end{bmatrix} -> R_2 <->R_3 \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 0 & 0 & 0 \\ \end{bmatrix} \]
\[ R_2 = 2*R_1+R_2 \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix} \]
The rank of B is 1 because when we reduce to row-echelon form we only get one pivot. This means there’s just 1 linearly independent row and the other 2 are linear combinations of the first row.
Problem set 2 Problem 1
Find the eigenvalues and eigenvectors for the matrix A
\(A= \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix}\)
To find the eigenvalues and eigenvectors will need to calculate \(det(\lambda I_3 - A = 0)\)
\[ 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} ) = 0 \]
\[ det( \begin{bmatrix} \lambda-1 & -2 & -3 \\ 0 & \lambda -4 & -5 \\ 0 & 0 & \lambda -6 \end{bmatrix} ) = 0 \]
\(( \lambda -1) ( \lambda - 4) ( \lambda - 6 ) + ( -2 * 5 * 0 ) + ( -3 * 0 *0 )+ ( -2 * 0 * ( \lambda-6 ) )+ ( (\lambda -1) * -5 * 0 ) + (-3 * (\lambda-4)*0) =0\)
\(( \lambda -1) ( \lambda - 4) ( \lambda - 6 )=0\)
\(( \lambda -1) = 0, \lambda=1\)
\(( \lambda -4) = 0, \lambda=4\)
\(( \lambda -6) = 0, \lambda=6\)
There are 3 eigenvalues for the matrix a and they are \(\lambda=1,4,6\)
Now to compute the eigenvectors we need to solve \((A- \lambda I)x=0\) for each eigenvalue
For = 1
\[ A- \lambda_1 I = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} - \begin{bmatrix} 1-1 & 0 & 0 \\ 0 & 1-4 & 0 \\ 0 & 0 & 1-6 \end{bmatrix} = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 7 & 5 \\ 0 & 0 & 11 \end{bmatrix} \]
Convert to row echelon form
\[ \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 5/7 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \]
This gives the system of equations:
\(x_1+2x_2+3x_3=0\)
\(x_2+5/7x_3=0\)
\(x_3=0\)
Let x_3 = a, then:
\(x_2+ 5/7(a) = 0\)
\(x_2=-5/7a\)
\(x_1+ 2(-5\7)(a)+3(a)=0\)
\(x_1=-11\7a\)
\(\lambda =1, \lambda_1=a\begin{bmatrix}-11/7\\-5/7\\1\end{bmatrix}\)
For = 4
\[ A- \lambda_1 I = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} - \begin{bmatrix} 4-1 & 0 & 0 \\ 0 & 4-4 & 0 \\ 0 & 0 & 4-6 \end{bmatrix} = \begin{bmatrix} -2 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 8 \end{bmatrix} \]
Reduce to row echelon form
\[ \begin{bmatrix} 1 & -1 & -3/2 \\ 0 & 1 & 5/4 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \]
This gives the system of equations:
\(x_1-x_2-3/2x_3=0\)
\(x_2+5/4x_3=0\)
\(\x_3=2=0\)
Let \(x_3=a\)
\(x_2+5/4a =0\)
\(x_2=-5/4a\)
\(x_1+5/4a-3/2a=0=\)
\(x_1=1/4a\)
\(\lambda =4, \lambda_2=a\begin{bmatrix}1/4\\-5/4\\1\end{bmatrix}\)
For = 6
\[ A- \lambda_1 I = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} - \begin{bmatrix} 6-1 & 0 & 0 \\ 0 & 6-4 & 0 \\ 0 & 0 & 6-6 \end{bmatrix} = \begin{bmatrix} -4 & 2 & 3 \\ 0 & 2 & 5 \\ 0 & 0 & 6 \end{bmatrix} \]
Reduce to row echelon form
\[ \begin{bmatrix} -4 & 2 & 3 \\ 0 & 2 & 5 \\ 0 & 0 & 6 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \]
This gives the system of equations:
\(-4x_1+2x_2+3x_3=0\)
\(2x_2+5x_3=0\)
Let \(x_3=a\)
\(2x_2+5(a)=0\)
\(x_2=5/2a\)
\(-4x_1+2(5/2a)+3(a)=0\)
\(-4x_1+8a=0\)
\(x_1=-2a\)
\(\lambda =6, \lambda_3=a\begin{bmatrix}-2\\5/2\\1\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)
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
# Compute the QR decomposition
qr_decomp <- qr(A)
# Extract the upper triangular matrix R
R <- qr.R(qr_decomp)
# Calculate the rank by counting non-zero diagonal elements
rank_A <- sum(diag(R) != 0)
# Print the rank of the matrix
print(rank_A)
## [1] 4
B <- matrix(c(1,3,2,2,6,4,1,3,2), nrow = 3)
B
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 3 6 3
## [3,] 2 4 2
# Compute the QR decomposition
qr_decomp <- qr(B)
# Extract the upper triangular matrix R
R <- qr.R(qr_decomp)
# Calculate the rank by counting non-zero diagonal elements
rank_B <- sum(diag(R) != 0)
# Print the rank of the matrix
print(rank_B)
## [1] 1
A<- matrix(c(1,0,0,2,4,0,3,5,6), nrow=3)
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