Question 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}\]

A <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-1), nrow = 4)
A
##      [,1] [,2] [,3] [,4]
## [1,]    1    2    3    4
## [2,]   -1    0    1    3
## [3,]    0    1   -2    1
## [4,]    5    4   -2   -1
Arank <- qr(A)$rank
sprintf('The rank of the above matrix is %s', Arank)
## [1] "The rank of the above matrix is 4"

Question 1.2

Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

#For a given matrix mxn, where m > n, the maximum rank is n and the minumum rank is 1.

Question 1.3

What is the rank of matrix B?

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

B <- matrix(c(1,3,2,2,6,4,1,3,2), nrow = 3)
Brank <- qr(B)$rank
sprintf('The rank for the above matrix is %s', Brank)
## [1] "The rank for the above matrix is 1"

Question 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}\]

\[det (\lambda I~n~ - A) = 0\] \[\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} = \begin{bmatrix} \lambda - 1 & -2 & -3\\ 0 & \lambda - 4 & -5\\ 0 & 0 & \lambda - 6 \end{bmatrix}\]

Determinate of Matrix

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

\[(\lambda - 1)((\lambda - 4)(\lambda -6)) - -2(0*0) + -3(0*0) \]

\[(\lambda - 1)(\lambda^2 - 10 \lambda + 24) \]

\[\lambda^3 - 10 \lambda ^2 + 24 \lambda -\lambda^2 + 10 \lambda - 24 \]

Characteristic Polynomial

\[ p(\lambda) = \lambda^3 - 11 \lambda ^2 + 34 \lambda - 24 = 0 \]

Eigen Values

We look at this line \[(\lambda - 1)(\lambda^2 - 10 \lambda + 24) \]

We see that \(\lambda\) = 1

When we factor \((\lambda^2 - 10 \lambda + 24)\), we get \((\lambda - 6)(\lambda - 4)\). Here, we see that also equals 6 and 4.

The eigen values are 1, 4, and 6.

Eigen vectors

A = matrix(c(1,0,0,2,4,0,3,5,6), nrow = 3)
x <- eigen(A)

#Using the eigen function we can get the eigen vectors of matrix A.
x$vectors
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0