library(pracma)
\[ 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)
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
The rank of the matrix is the number of non-zero rows, which are linearly independent from one another. At first glance, there are 4 non-zero rows and the rows appear to be linearly independent from one another. I will use a row echelon form to determine this:
\[A = \begin{bmatrix} 1 & 2 & 3 & 4 \\ -1 & 0 & 1 & 3 \\ 0 & 1 & -2 & 1 \\5 & 4 & -2 & -3\end{bmatrix} \to 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_4$ = -5R_1 + R_4 = \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 1 & -2 & 1 \\5 & 4 & -2 & -3\end{bmatrix}\to \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 1 & -2 & 1 \\0 & -6 & -17 & -23\end{bmatrix} \]
\[R_3 = -0.5R_2 + R_3 = \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 1 & -2 & 1 \\0 & -6 & -17 & -23\end{bmatrix}\to \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 0 & -2 & -3.5 \\0 & -6 & -17 & -23\end{bmatrix} \]
\[R_4 = 3R_2 + R_4 = \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 0 & -2 & -3.5 \\0 & -6 & -17 & -23\end{bmatrix}\to \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 0 & -2 & -3.5 \\0 & 0 & -5 & -2\end{bmatrix} \]
\[R_4 = 1.25R_2$ + R_4 = \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 0 & -2 & -3.5 \\0 & 0 & -5 & -2\end{bmatrix} \to\begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 7 \\0 & 0 & -2 & -3.5 \\0 & 0 & 0 & 6.75\end{bmatrix} \]
The upper triangular matrix is formed. The rank of this matrix is 4, since there are 4 non-zero rows. Using the Rank() function, the matrix of A is indeed 4.
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(A)
## [1] 4
The maximum rank of a m x n matrix where m > n would be determined by the number of linearly independent columns, which in this instance would be n. The minimum rank would be 1, since there would be at least one row and column that contains a nonzero value.
\[ 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)
It appears that \(R_1\) and \(R_2\) are linearly dependent, since multiplying each value in \(R_1\) by 3 results in the values in \(R_2\).
\[R_2 = -3R_1 + R_2 = \begin{bmatrix} 1 & 2 & 1 \\ 3 & 6 & 3 \\2 & 4 & 2\end{bmatrix} \to \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\2 & 4 & 2\end{bmatrix} \]
\[R_3 = -2R_1 + R_2\begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\2 & 4 & 2\end{bmatrix} \to\begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\0 & 0 & 0\end{bmatrix} \] After using row echelon form, there was only 1 nonzero row in the matrix, meaning that there is only 1 row that is linearly independent. Therefore, the rank of the matrix is 1. Using the Rank() function, the matrix of B is indeed 1.
Rank(B)
## [1] 1
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} \]
X <- matrix(c(1,2,3,0,4,5,0,0,6), nrow=3, byrow=TRUE)
The solution I’ll use to find the eigenvalues is: det(\(A\)-\(\lambda\)I) = 0
\[ A-$\lambda$I = \begin{bmatrix} 1 & 2 & 3\\ 0 & 4 & 5 \\0 & 0 & 6\end{bmatrix} - \begin{bmatrix} 1 & 0 & 0\\0 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix} = \begin{bmatrix} 1-\lambda & 2 & 3\\ 0 & 4-\lambda & 5 \\0 & 0 & 6-\lambda\end{bmatrix} \]
Since column 1 has the most zeros, I will use that column to find the determinant, starting with row 1, column 1:
\[1-$\lambda$\begin{bmatrix} 4-\lambda & 5 \\0 & 6-\lambda\end{bmatrix} \]
1-\(\lambda\)[(4-\(\lambda\))(6-\(\lambda\)) - (5)(0)] = 1-\(\lambda\)(\(\lambda\)^2 -10\(\lambda\) + 24) =
1 * \(\lambda\)^2 - 10\(\lambda\) + 24 = \(\lambda\)^2 -10\(\lambda\) + 24
-\(\lambda\) * \(\lambda\)^2 -10\(\lambda\) + 24 = -\(\lambda\)^3 + 10\(\lambda\)^2 - 24\(\lambda\)
(\(\lambda\)^2 - 10\(\lambda\) + 24) + (-\(\lambda\)^3 + 10\(\lambda\)^2 - 24\(\lambda\)) = -1(-\(\lambda\)^3 + 11\(\lambda\)^2 - 34\(\lambda\) + 24) = \(\lambda\)^3 - 11\(\lambda\)^2 + 34\(\lambda\) - 24
The character polynomial is \(\lambda\)^3 - 11\(\lambda\)^2 + 34\(\lambda\) - 24. I can confirm this using
the charploy() function from the library pracma:
charpoly(X)
## [1] 1 -11 34 -24
Next, we’ll solve for the eigenvalues of the character polynomial:
\(\lambda\)^3 - 11\(\lambda\)^2 + 34\(\lambda\) - 24 = 0
The values used to solve the determinant of the 3x3 matrix are the eigenvalues: (1-\(\lambda\))(4-\(\lambda\))(6-\(\lambda\)).
Therefore, the eigenvalues of the matrix is 1, 4, and 6. This is confirmed by using the eigen() function:
ev <- eigen(X)
values <- ev$values
values
## [1] 6 4 1
Finally, I will solve for the eigenvectors:
Using each eigenvalue separately, I will input the value into the original equation, with vector=x: (\(A\)-\(\lambda\)I)x = 0
\[ A = \begin{bmatrix} 1 & 2 & 3\\ 0 & 4 & 5 \\0 & 0 & 6\end{bmatrix} - \begin{bmatrix} 6 & 0 & 0\\ 0 & 6 & 0 \\0 & 0 & 6 \end{bmatrix} = \begin{bmatrix} -5 & 2 & 3\\ 0 & -2 & 5 \\0 & 0 & 0\end{bmatrix} \]
\[ A = \begin{bmatrix} -5 & 2 & 3\\ 0 & -2 & 5 \\0 & 0 & 0\end{bmatrix} \begin{bmatrix} x\\y\\z\end{bmatrix} = 0 \]
-5x + 2y+3z = 0,
0x + -2y+5z = 0,
0x + 0y + 0z = 0 (free variable)
\(\downarrow\)
-5x + 2y + 3z = 0,
-2y + 5z = 0
\[\begin{bmatrix} -5 & 2 & 3\\ 0 & -2 & 5\end{bmatrix} = \begin{bmatrix} 2 & 3\\-2 & 5\end{bmatrix} = (2\times5) - (3\times-2) = 10-(-6)=16 \]
\[\begin{bmatrix} -5 & 2 & 3\\ 0 & -2 & 5\end{bmatrix} = \begin{bmatrix} -5 & 3\\0 & 5\end{bmatrix} = (-5\times5) - (3\times0) = -25-0=-25 \]
\[\begin{bmatrix} -5 & 2 & 3\\ 0 & -2 & 5\end{bmatrix} = \begin{bmatrix} -5 & -2\\0 & -2\end{bmatrix} = (-5\times-2) - (2\times0) = 10-0=10 \]
The eigenvector when \(\lambda\) = 6 is:
\[\begin{bmatrix} 16\\-25\\10\end{bmatrix} \]
\[ A = \begin{bmatrix} 1 & 2 & 3\\ 0 & 4 & 5 \\0 & 0 & 6\end{bmatrix} - \begin{bmatrix} 4 & 0 & 0\\ 0 & 4 & 0 \\0 & 0 & 4 \end{bmatrix} =\begin{bmatrix} -3 & 2 & 3\\ 0 & 0 & 5 \\0 & 0 & 2\end{bmatrix} \]
\[ A = \begin{bmatrix} -3 & 2 & 3\\ 0 & 0 & 5 \\0 & 0 & 2\end{bmatrix} \begin{bmatrix} x\\y\\z\end{bmatrix} = 0 \]
-3x + 2y + 3z = 0,
0x + 0y + 5z = 0,
0x + 0y + 2z = 0
\(\downarrow\)
-3x + 2y + 3z = 0,
5z = 0,
2z = 0
\[\begin{bmatrix} -3 & 2 & 3\\ 0 & 0 & 5\end{bmatrix} = \begin{bmatrix} 2 & 3\\0 & 5\end{bmatrix} = (2\times5) - (3\times0) = 10-0=10 \]
\[\begin{bmatrix} -3 & 2 & 3\\ 0 & 0 & 5\end{bmatrix} = \begin{bmatrix} -3 & 3\\0 & 5\end{bmatrix} = (-3\times5) - (3\times0) = -15-0=-15 \]
\[\begin{bmatrix} -3 & 2 & 3\\ 0 & 0 & 5\end{bmatrix} = \begin{bmatrix} -3 & 2\\0 & 3\end{bmatrix} = (-3\times0) - (2\times0) = 0 \]
The eigenvector when \(\lambda\) = 4 is:
\[\begin{bmatrix} 10\\-15\\0\end{bmatrix} \]
which can be reduced by dividing the values by 5:
\[\begin{bmatrix} 2\\-3\\0\end{bmatrix} \]
\[ A = \begin{bmatrix} 1 & 2 & 3\\ 0 & 4 & 5 \\0 & 0 & 6\end{bmatrix} -\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} 0 & 2 & 3\\ 0 & 3 & 5 \\0 & 0 & 5\end{bmatrix} \]
\[A = \begin{bmatrix} 0 & 2 & 3\\ 0 & 3 & 5 \\0 & 0 & 5\end{bmatrix} \begin{bmatrix} x\\y\\z\end{bmatrix} = 0 \]
0x + 2y + 3z = 0,
0x + 3y + 5z = 0,
0x + 0y + 5z = 0
\(\downarrow\)
2y + 3z = 0,
3y + 5z = 0,
5z = 0
\[\begin{bmatrix} 0 & 2 & 3\\ 0 & 3 & 5\end{bmatrix} = \begin{bmatrix} 2 & 3\\3 & 5\end{bmatrix} = (2\times5) - (3\times3) = 10-9=1 \]
\[\begin{bmatrix} 0 & 2 & 3\\ 0 & 3 & 5\end{bmatrix} = \begin{bmatrix} 0 & 3\\0 & 5\end{bmatrix} = (0\times5) - (0\times3) = 0 \]
\[\begin{bmatrix} 0 & 2 & 3\\ 0 & 3 & 5\end{bmatrix} = \begin{bmatrix} 0 & 2\\0 & 3\end{bmatrix} = (0\times5) - (0\times3) = 0 \]
The eigenvector when \(\lambda\) = 1 is:
\[\begin{bmatrix} 1\\0\\0\end{bmatrix} \]
vectors <- ev$vectors
vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0