B<- matrix(c(2,0,0,0,0,3,1,0,1,0,0,1,1,2,0,2,1,2,1,1,1,2,3,0,2),5)
B
## [,1] [,2] [,3] [,4] [,5]
## [1,] 2 3 0 2 1
## [2,] 0 1 1 1 2
## [3,] 0 0 1 2 3
## [4,] 0 1 2 1 0
## [5,] 0 0 0 1 2
find the determinant by column 1
2* det(C)
where C is 4x4 matrix
C<- matrix(c(1,0,1,0,1,1,2,0,1,2,1,1,2,3,0,2),4)
C
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 2
## [2,] 0 1 2 3
## [3,] 1 2 1 0
## [4,] 0 0 1 2
operate R3 -> R3 -R1
C reduces to
C<- matrix(c(1,0,0,0,1,1,1,0,1,2,0,1,2,3,-2,2),4)
C
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 2
## [2,] 0 1 2 3
## [3,] 0 1 0 -2
## [4,] 0 0 1 2
find the determinant by C1
det(C) = 1* det(D)
where D is 3x3 matrix
D<- matrix(c(1,1,0,2,0,1,3,-2,2),3)
D
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 1 0 -2
## [3,] 0 1 2
Apply the sarrus rule to matrix D and find the determinant
det(D) = 1*0 * 2 + 2 *-2* 0 + 3*1*1 -(2*1*2 + 1*-2*1 + 3* 0 *0) = 3 -2 = 1
det(B) = 2* det(C) = 2*1*det(D) = 2 * 1*1 = 2