Doing the computations by hand, find the determinant of the matrix below.
cat("Matrix A", "\n", "\n")
## Matrix A
##
(A = matrix (c(1,3,6,2), ncol = 2, byrow = TRUE))
## [,1] [,2]
## [1,] 1 3
## [2,] 6 2
The formula for finding the determinant for a 2x2 matrix is |A| = ad - bc
First, we find the values of ad by multiplying 1 x 2
(AD <- A[1,1] * A[2,2])
## [1] 2
Next, we find the values of bc by multiplying 3 x 6
(BC <- A[1,2] * A[2,1])
## [1] 18
Lastly, we subtract ad from bc
(AD-BC)
## [1] -16
Using the built-in features from base R we can check our work
det(A)
## [1] -16