DATA 605: Assignment 3

Problem Set #1

1) What is the rank of matrix \(A\)?

A <- matrix(c(1,2,3,4,
              -1,0,1,3,
              0,1,-2,1,
              5,4,-2,3),
            4, byrow=TRUE)
print(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 a matrix is defined as the number of linearly independent columns (or rows) in the matrix. This can be determined by reducing the matrix to row echelon form and counting the number of non-zero rows.

# calculate reduced row echelon form of the matrix
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

Solution: Since there are 4 non-zero rows, the rank of matrix \(A\) = 4.

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

If \(A\) is an \(mxn\) matrix, with \(m\) rows and \(n\) columns, then the row rank of \(A <= m\) and the column rank of \(A <= n\), and the row rank of \(A\) = the column rank of \(A\), so the maximum rank is the smaller of the row and column ranks. So the maximum rank for an \(mxn\) matrix where \(m > n\) is the rank of \(n\). The minimum rank of a non-zero matrix is 1.

3) What is the rank of matrix \(B\)?

#define matrix B
B <- matrix(c(1,2,1,
              3,6,3,
              2,4,2),
            3,
              byrow=TRUE)
B
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    3    6    3
## [3,]    2    4    2
rref(B)
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0

Solution: The rank of matrix \(B\) is 1, since there is only 1 non-zero row in its reduced row echelon form.

Problem Set #2

Compute the eigenvalues and eigenvectors of the matrix \(A\).

#define matrix A
A <- matrix(c(1,2,3,
              0,4,5,
              0,0,6),3,
            byrow=TRUE)
A
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    4    5
## [3,]    0    0    6

\(λ\) is an eigenvalue of \(A\) if \(Av = λv\) when \(v\) is a nonzero vector.

Since \(λv - Av = 0 -> (λI_{n} - A)v = 0\) we can find the eigenvalues and characteristic polynomial of the matrix by solving for \(λ\) when \(det(λΙ_{n}-A) = 0\). The determinant of a triangular matrix can be calculated by multiplying it’s diagonal, so:

\((λ - 1)(λ - 4)(λ - 6) = 0\), so the eigenvalues are \(λ=1, λ=4, λ=6\).

The characteristic polynomial is the expansion of the equation, yielding \(λ^3 - 11λ^2 + 34λ - 24 = 0\).

# find the eigenvalues of matrix A
eigen(A)[1]
## $values
## [1] 6 4 1

The charpoly function in pracma returns a vector of coefficients of the characteristic polynomial:

# find the characteristic polynomial
charpoly(A)
## [1]   1 -11  34 -24

To find the eigenvectors, solve \((A - λI_{n})v = 0\).

\[λ(1) = \begin{bmatrix} 0 & 2 & 3 \\ 0 & 3 & 5 \\ 0 & 0 & 5 \\ \end{bmatrix}\]

Which reduces to:

λ1 <- matrix(c(0,2,3,
               0,3,5,
               0,0,5),3,
             byrow=TRUE)
rref(λ1)
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2,]    0    0    1
## [3,]    0    0    0

\((A - λΙ)\)\(\begin{bmatrix}x\\y\\z\\\end{bmatrix}\)

\(= 0x + 1y + 0z = 1y = 0\)
\(= 0x + 0y + 1z = 1z = 0\)
\(= 0x + 0y + 0z = 0\)

\(= \begin{bmatrix}\\0\\0\\\end{bmatrix}\)

Since x does not appear in the equations, the eigenvector is \(\begin{bmatrix}x\\0\\0\\\end{bmatrix}\), or \(\begin{bmatrix}1\\0\\0\\\end{bmatrix}\)

Following this process for λ(4) and λ(6):

λ4 <- matrix(c(-1,2,3,
               0,0,5,
               0,0,2),3,
             byrow=TRUE)
rref(λ4)
##      [,1] [,2] [,3]
## [1,]    1   -2    0
## [2,]    0    0    1
## [3,]    0    0    0

\((A - λΙ)\)\(\begin{bmatrix}x\\y\\z\\\end{bmatrix}\)

\(= 1x + (-2)y + 0z = 0 => χ - 2y = 0 => χ = 2/3y\)
\(= 0x + 0y + 1z = 0 => z = 0\)
\(= 0x + 0y + 0z = 0\)

\(=\begin{bmatrix}2/3y\\y\\0\\\end{bmatrix}\)
\(=\begin{bmatrix}2\\3\\0\\\end{bmatrix}\)

λ6 <- matrix(c(-5,2,3,
               0,-2,5,
               0,0,0),3,
             byrow=TRUE)
rref(λ6)
##      [,1] [,2] [,3]
## [1,]    1    0 -1.6
## [2,]    0    1 -2.5
## [3,]    0    0  0.0

\((A - λΙ)\)\(\begin{bmatrix}x\\y\\z\\\end{bmatrix}\)

\(= 1x + 0y + (-1.6)z = 0 => χ - 1.6z = 0 => χ = 1.6z\)

\(= 0x + 1y + (-2.5z) = 0 => y = 2.5z\)

\(= 0x + 0y + 0z = 0\)

\(=\begin{bmatrix}1.6z\\2.5z\\z\\\end{bmatrix}\)

\(=\begin{bmatrix}1.6\\2.5\\1\\\end{bmatrix}\)

So the eigenvectors of matrix \(A\) are:

\(\begin{bmatrix}1\\0\\0\\\end{bmatrix}\),\(\begin{bmatrix}2\\3\\0\\\end{bmatrix}\),\(\begin{bmatrix}1.6\\2.5\\1\\\end{bmatrix}\)