DATA 605 FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS

Assignment 3

Kyle Gilde

9/15/2017

##               
## prettydoc TRUE
## pracma    TRUE
## ppls      TRUE

1. Problem set 1

  1. What is the rank of the matrix A?
\[\begin{equation}A = \begin{bmatrix} 1 & 2 & 3 & 4\\ −1 & 0 & 1 & 3\\ 0 & 1 & −2 & 1\\ 5 & 4 & −2 & −3 \end{bmatrix}\end{equation}\]
d <- c(1, 2, 3, 4, -1, 0, 1, 3, 0, 1, -2, 1, 5, 4, -2, -3)
A <- matrix(d, 4, 4, byrow = T)
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
Aqr <- qr(A)
Aqr$rank
## [1] 4
  1. Given an mxn matrix where m > n, what can be the maximum rank? The minimum rank, assuming that the matrix is non-zero?

The maximum rank can be no greater than n. The minimum rank is 1.

  1. What is the rank of matrix B?
\[\begin{equation}B = \begin{bmatrix} 1 & 2 & 1\\3 & 6 & 3\\ 2 & 4 & 2\\ \end{bmatrix}\end{equation}\]

d <- c(1, 2, 1, 3, 6, 3, 2, 4, 2)
A <- matrix(d, 3, byrow = T)
rref(A)
##      [,1] [,2] [,3]
## [1,]    1    2    1
## [2,]    0    0    0
## [3,]    0    0    0
Aqr <- qr(A)
Aqr$rank
## [1] 1

2. 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.

\[\begin{equation}A = \begin{bmatrix} 1 & 2 & 3\\0 & 4 & 5\\ 0 & 0 & 6\\ \end{bmatrix}\end{equation}\] \[\begin{equation}x(\lambda I - A) = 0\end{equation}\] \[\begin{equation}det(\lambda I - A) = 0\end{equation}\]
  1. \[\begin{equation} \begin{array}{|c|} \lambda \begin{bmatrix} 1 & 0 & 0\\0 & 1 & 0\\ 0 & 0 & 1\\ \end{bmatrix} - \begin{bmatrix} 1 & 2 & 3\\0 & 4 & 5\\ 0 & 0 & 6\\ \end{bmatrix}\end{array} = 0 \end{equation}\]
  2. \[\begin{equation} \begin{array}{|c|} \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}\end{array} = 0 \end{equation}\]
  3. \[\begin{equation} \begin{array}{|c|} \lambda - 1 & -2 & -3\\ 0 & \lambda - 4 & -5\\ 0 & 0 & \lambda - 6 \end{array} = 0 \end{equation}\]
\[\begin{equation} (\lambda - 1) \begin{array}{|cc|} \lambda - 4 & -5\\ 0 & \lambda - 6 \end{array} - (-2) \begin{array}{|cc|} 0 & -5 \\ 0 & \lambda - 6 \end{array} + -3 \begin{array}{|cc|} 0 & \lambda - 4 \\ 0 & 0 \end{array} = 0 \end{equation}\]
  1. \[\begin{equation} (\lambda - 1)((\lambda - 4)(\lambda - 6) - 0) + 2((0)-(0)) - 3((0)-(0)) = 0 \end{equation}\]
  2. Eigenvalues: \[\begin{equation} (\lambda - 1)(\lambda - 4)(\lambda - 6) = 0 \end{equation}\]
\[\begin{equation} \lambda = 6, 4, 1 \end{equation}\]
# validate
d <- c(1, 2, 3, 0, 4, 5, 0, 0, 6)
A <- matrix(d, 3, byrow = T)
Aeigen <- eigen(A)
Aeigen$values
## [1] 6 4 1
  1. \[\begin{equation} (\lambda^2 - 5\lambda + 4)(\lambda - 6) = 0 \end{equation}\]
  2. \[\begin{equation} \lambda^3 - 5\lambda^2 + 4\lambda + -6\lambda^2 + 30\lambda -24 = 0 \end{equation}\]
  3. Characteristic Polynomial: \[\begin{equation} p_{A}(\lambda) = \lambda^3 - 11\lambda^2 + 34\lambda -24 \end{equation}\]
# validate
charpoly(A)
## [1]   1 -11  34 -24
  1. To get each eigenvector, let’s substitute each \(\lambda\) into the matrix from step 3 and find the null spaces
\[\begin{equation} \begin{bmatrix} \lambda - 1 & -2 & -3\\ 0 & \lambda - 4 & -5\\ 0 & 0 & \lambda - 6 \end{bmatrix}x = 0 \end{equation}\]

a.For \(\lambda = 6\)

\[\begin{equation} \begin{bmatrix} 5 & -2 & -3\\ 0 & 2 & -5\\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 1 & -2/5 & -3/5\\ 0 & 1 & -5/2\\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 1 & 0 & -8/5\\ 0 & 1 & -5/2\\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \end{equation}\] \[\begin{equation} v_1 = 8/5v_3, v_2 = 5/2v_3 \end{equation}\] \[\begin{equation} x = \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = v_3\begin{bmatrix} 8/5 \\ 5/2 \\ 1 \end{bmatrix} = \begin{bmatrix} 8/5 \\ 5/2 \\ 1 \end{bmatrix} \end{equation}\] \[\begin{equation} E_{\lambda=6} = \begin{bmatrix} 8/5 \\ 5/2 \\ 1 \end{bmatrix} \end{equation}\]

Normalized:

\[\begin{equation} ||x|| = \sqrt{(8/5)^2 + (5/2)^2 + 1^2} = 3.132092 \end{equation}\] \[\begin{equation} E_{\lambda=6} = \begin{bmatrix} 0.5108407 \\ 0.7981886 \\ 0.3192754 \end{bmatrix} \end{equation}\]
# validated
x <- c(8/5, 5/2, 1)
(xlen <- norm(x, type = "2"))
## [1] 3.132092
x/xlen
## [1] 0.5108407 0.7981886 0.3192754
all.equal(x/xlen, Aeigen$vectors[, 1])
## [1] TRUE

b. For \(\lambda = 4\)

\[\begin{equation} \begin{bmatrix} 3 & -2 & -3\\ 0 & 0 & -5\\ 0 & 0 & -2 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 1 & -2/3 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \end{equation}\] \[\begin{equation} v_1 = 2/3v_2, v_3 = 0v_2 \end{equation}\] \[\begin{equation} x = \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = v_2\begin{bmatrix} 2/3 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 2/3 \\ 1 \\ 0 \end{bmatrix} \end{equation}\] \[\begin{equation} E_{\lambda=6} = \begin{bmatrix} 2/3 \\ 1 \\ 0 \end{bmatrix} \end{equation}\]

Normalized:

\[\begin{equation} ||x|| = \sqrt{(2/3)^2 + 1^2 + 0^2} = 1.20185 \end{equation}\] \[\begin{equation} E_{\lambda=6} = \begin{bmatrix} 0.5547002 \\ 0.8320503 \\ 0.0000000 \end{bmatrix} \end{equation}\]
# validated
d <- c(3, -2, -3, 0, 0, -5, 0, 0, -2)
D <- matrix(d, 3, 3, byrow = T)
rref(D)
##      [,1]       [,2] [,3]
## [1,]    1 -0.6666667    0
## [2,]    0  0.0000000    1
## [3,]    0  0.0000000    0

x <- c(2/3, 1, 0)
(xlen <- norm(x, type = "2"))
## [1] 1.20185
x/xlen
## [1] 0.5547002 0.8320503 0.0000000
all.equal(x/xlen, Aeigen$vectors[, 2])
## [1] TRUE

c. For \(\lambda = 1\)

\[\begin{equation} \begin{bmatrix} 0 & -2 & -3\\ 0 & -3 & -5\\ 0 & 0 & -5 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \end{equation}\] \[\begin{equation} v_2 = 0v_1, v_3 = 0v_1 \end{equation}\] \[\begin{equation} x = \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = v_1\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \end{equation}\] \[\begin{equation} E_{\lambda=6} = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \end{equation}\]

Normalized:

\[\begin{equation} ||x|| = \sqrt{1^2 + 0^2 + 0^2} = 1 \end{equation}\] \[\begin{equation} E_{\lambda=6} = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \end{equation}\]
# validated
d <- c(0, -2, -3, 0, -3, -5, 0, 0, -5)
D <- matrix(d, 3, 3, byrow = T)
rref(D)
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2,]    0    0    1
## [3,]    0    0    0

x <- c(1, 0, 0)
(xlen <- norm(x, type = "2"))
## [1] 1
x/xlen
## [1] 1 0 0
all.equal(x/xlen, Aeigen$vectors[, 3])
## [1] TRUE

Please show your work using an R-markdown document. Please name your assignment submission with your first initial and last name.