Load library

suppressMessages(
  library(tidyverse),
  library(tinytex)
)
## Warning: package 'tinytex' was built under R version 4.3.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

Problem Set 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} \] None of the rows and columns are multiples of each other. Performing row reduction on A \[ \begin{aligned} \begin{bmatrix} 1 & 2 & 3 & 4 \\-1 & 0 & 1 & 3 \\0 & 1 & -2 & 1 \\5 & 4 & -2 & -3 \end{bmatrix}R_4 + 5R_2 &\rightarrow \begin{bmatrix} 1 & 2 & 3 & 4 \\-1 & 0 & 1 & 3 \\0 & 1 & -2 & 1 \\0 & 4 & 3 & 12 \end{bmatrix} \\R_4 - 4R_2 &\rightarrow \begin{bmatrix} 1 & 2 & 3 & 4 \\-1 & 0 & 1 & 3 \\0 & 1 & -2 & 1 \\0 & 0 & 11 & 8 \end{bmatrix} \\R_2 + 1R_1 &\rightarrow \begin{bmatrix} 1 & 2 & 3 & 4 \\0 & 2 & 4 & 7 \\0 & 1 & -2 & 1 \\0 & 0 & 11 & 8 \end{bmatrix} \\swap(R_3, R_2) &\rightarrow \begin{bmatrix} 1 & 2 & 3 & 4 \\0 & 1 & -2 & 1 \\0 & 2 & 4 & 7 \\0 & 0 & 11 & 8 \end{bmatrix} \\R_3 - 2R_2 &\rightarrow \begin{bmatrix} 1 & 2 & 3 & 4 \\0 & 1 & -2 & 1 \\0 & 0 & 8 & 5 \\0 & 0 & 11 & 8 \end{bmatrix} \\R_4 - \frac{11}{8}R_3 &\rightarrow \begin{bmatrix} 1 & 2 & 3 & 4 \\0 & 1 & -2 & 1 \\0 & 0 & 8 & 5 \\0 & 0 & 0 & 1\frac{1}{8} \end{bmatrix} \end{aligned} \] Matrix \(A\) can’t reduce any further. That means all the rows and columns are independent of one another. Therefore the rank of \(A\) \(=4\)

Checking with R:

A <- matrix(c(1, 2, 3, 4, -1, 0, 1, 3, 0, 1, -2, 1, 5, 4, -2, -3),
            nrow = 4, 
            ncol = 4,
            byrow = TRUE)
cat('Rank of A:', qr(A)$rank)
## Rank of A: 4

Problem Set 1.2

Given an m by n matrix, where m \(>\) n, what can be the maximum rank?

The maximum rank of a matrix is the minimum between the number of rows and the number of columns. In this case the number of columns is less than the number of rows so the maximum rank is n.

The minimum rank, assuming that the matrix is non-zero?

For a non-zero matrix the minimum possible rank is 1. The rank of a matrix is defined as the maximum number of linearly independent rows or columns. Therefore in a non-zero matrix there will be at least one linearly independent row or column.

Problem Set 1.3

What is the rank of matrix B?

\[ B = \begin{bmatrix} 1 & 2 & 1 \\3 & 6 & 3 \\2 & 4 & 2 \end{bmatrix} \] \(R_2\) and \(R_3\) are multiples of \(R_1\). The row reduced form of \(B\) is \[ \begin{bmatrix} 1 & 2 & 1 \\0 & 0 & 0 \\0 & 0 & 0 \end{bmatrix} \] Therefore the rank of \(B\) \(=1\)

Checking with R:

B <- matrix(c(1, 2, 1,3, 6, 3, 2, 4, 2),
            nrow = 3,
            ncol = 3,
            byrow = TRUE)
cat('Rank of B:', qr(B)$rank)
## Rank of B: 1

Problem Set 2

\[ A = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} \] Characteristic Polynomial: Solve \(\det(A - \lambda I) = 0\)

\[ \begin{aligned} \det(\begin{bmatrix}1 & 2 & 3 \\0 & 4 & 5 \\0 & 0 & 6 \end{bmatrix} - \lambda \begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}) &= \det(\begin{bmatrix}1 & 2 & 3 \\0 & 4 & 5 \\0 & 0 & 6 \end{bmatrix} - \begin{bmatrix}\lambda & 0 & 0 \\ 0 & \lambda & 0 \\ 0 & 0 & \lambda \end{bmatrix}) \\ &= \det(\begin{bmatrix}1 - \lambda & 2 & 3 \\0 & 4 - \lambda & 5 \\0 & 0 & 6 - \lambda \end{bmatrix}) \\ &= (6 - \lambda)\det(\begin{bmatrix}1 - \lambda & 2 \\0 & 4 - \lambda \end{bmatrix}) \\ &= (6 - \lambda)(1 - \lambda)(4 - \lambda) = 0 \end{aligned} \] Therefore the eigenvalues for \(A\) are \(6, 1,\) and \(4\)

Next step is to solve \((A - \lambda I)\overline{X} = \overline{0}\) \[ \begin{bmatrix}1-\lambda & 2 & 3 \\0 & 4-\lambda & 5\\0 & 0 & 6-\lambda \end{bmatrix} \begin{bmatrix}x \\y \\z \end{bmatrix} = \begin{bmatrix}0 \\0 \\0 \end{bmatrix} \]

The eigenvector for \(A\) where eigenvalue, \((\lambda) = 6\) : \[ \begin{bmatrix}-5 & 2 & 3 \\0 & -2 & 5 \\0 & 0 & 0 \end{bmatrix}\vert \begin{bmatrix}0 \\0 \\0\end{bmatrix} \] The equivalent system of equation is \[ \begin{aligned} -5x &+ 2y + 3z = 0 \\ &-2y + 5z =0 \end{aligned} \] \(z\) is free. Therefore \[z = t\] \[ \begin{aligned} -2y +5z = -2y + 5t &= 0 \\ -2y &= 5t \\ y &= \frac{5}{2}t \end{aligned} \]

\[ \begin{aligned} -5x + 2y + 3z = -5x + 2(\frac{5}{2}t) + 3t &= 0 \\ -5x + 8t &= 0 \\ x &= \frac{8}{5}t \end{aligned} \]

Thus the eigenvector for \(\lambda = 6\): \(\begin{bmatrix}16 \\25 \\10 \end{bmatrix}\)

The eigenvector for \(A\) where eigenvalue, \((\lambda) = 4\) : \[ \begin{aligned} \begin{bmatrix}-3 & 2 & 3 \\0 & 0 & 5 \\0 & 0 & 2 \end{bmatrix}\vert \begin{bmatrix}0 \\0 \\0\end{bmatrix}\frac{1}{2}R_3 &\rightarrow \begin{bmatrix}-3 & 2 & 3 \\0 & 0 & 5 \\0 & 0 & 1 \end{bmatrix}\vert \begin{bmatrix}0 \\0 \\0\end{bmatrix} \\ R_2 - 5R_3 &\rightarrow \begin{bmatrix}-3 & 2 & 3 \\0 & 0 & 0 \\0 & 0 & 1 \end{bmatrix}\vert \begin{bmatrix}0 \\0 \\0\end{bmatrix} \end{aligned} \] The equivalent system of equation is \[ \begin{aligned} -3x + 2y + 3z &= 0 \\ z &= 0 \end{aligned} \] \(y\) is free. Therefore \[y = t\] However, note, \[z = 0\] Therefore, \[ \begin{aligned} -3x + 2y &= 0 \\ x &= \frac{2}{3}y \end{aligned} \]

Thus the eigenvector for \(\lambda = 4\): \(\begin{bmatrix}2 \\3 \\0 \end{bmatrix}\)

The eigenvector for \(A\) where eigenvalue, \((\lambda) = 1\) : \[ \begin{aligned} \begin{bmatrix}0 & 2 & 3 \\0 & 3 & 5 \\0 & 0 & 5 \end{bmatrix}\vert \begin{bmatrix}0 \\0 \\0\end{bmatrix}R_2 - \frac{3}{2}R_1 &\rightarrow \begin{bmatrix}0 & 2 & 3 \\0 & 0 & \frac{1}{2} \\0 & 0 & 5 \end{bmatrix}\vert \begin{bmatrix}0 \\0 \\0\end{bmatrix} \\ R_3 - 10R_2 &\rightarrow \begin{bmatrix}0 & 2 & 3 \\0 & 0 & \frac{1}{2} \\0 & 0 & 0 \end{bmatrix}\vert \begin{bmatrix}0 \\0 \\0\end{bmatrix} \end{aligned} \] The equivalent system of equation is \[ \begin{aligned} 2y + 3z &= 0 \\ \frac{1}{2}z &= 0 \end{aligned} \] \(x\) is free. Therefore \[x = t\] However, note, \[z = 0\] Therefore, \[y = 0\]

Thus the eigenvector for \(\lambda = 1\): \(\begin{bmatrix}1 \\0 \\0 \end{bmatrix}\)

Using R:

A <- matrix(c(1, 2, 3, 0, 4, 5, 0, 0, 6), nrow = 3, byrow = TRUE)
print('The eigenvalues for A:')
## [1] "The eigenvalues for A:"
eigen_value <- eigen(A)$values
print(eigen_value)
## [1] 6 4 1
## [1]
print('The corresponding eigenvectors to the eigenvalues:')
## [1] "The corresponding eigenvectors to the eigenvalues:"
eigen_vector <- eigen(A)$vectors
print(eigen_vector)
##           [,1]      [,2] [,3]
## [1,] 0.5108407 0.5547002    1
## [2,] 0.7981886 0.8320503    0
## [3,] 0.3192754 0.0000000    0