C22, Page 353
Doing the computations by hand, find the determinant of the matrix below.
\[\begin{bmatrix} 1 & 3\\ 2 & 6 \end{bmatrix}\]

#I will write a function in R to calculate the determinant of a 2x2 matrix

my_determinant <- function(det){
  a <- det[1, 1]
  b <- det[1, 2]
  c <- det[2, 1]
  d <- det[2, 2]
  return (a*d - b*c)
}

A <- matrix(c(1, 2, 3, 6), 2, 2, byrow = TRUE)
my_determinant(A)
## [1] 0
det(A) #using built-in function
## [1] 0
#Check another 2x2 matrix
B <- matrix(c(1, 6, 3, 2), 2, 2, byrow = TRUE)
my_determinant(B)
## [1] -16
det(B)
## [1] -16