Example

Doing the computations by hand, find the determinant of the matrix A (Question C30, Page 354).

For this problem, I will reduce the matrix to a triangular matrix and use the diagonal to find the determinant.

Matrix A

##      [,1] [,2] [,3] [,4] [,5]
## [1,]    2    1    1    0    1
## [2,]    2    1    2   -1    1
## [3,]    0    0    1    2    0
## [4,]    1    0    3    1    1
## [5,]    2    1    1    2    1

Step 1 - Subtract Row 1 from Row 5

##      [,1] [,2] [,3] [,4] [,5]
## [1,]    2    1    1    0    1
## [2,]    2    1    2   -1    1
## [3,]    0    0    1    2    0
## [4,]    1    0    3    1    1
## [5,]    0    0    0    2    0

Step 2 - Subtract Row 1 from Row 2

##      [,1] [,2] [,3] [,4] [,5]
## [1,]    2    1    1    0    1
## [2,]    0    0    1   -1    0
## [3,]    0    0    1    2    0
## [4,]    1    0    3    1    1
## [5,]    0    0    0    2    0

Step 3 - Subtract Row 2 from Row 3

##      [,1] [,2] [,3] [,4] [,5]
## [1,]    2    1    1    0    1
## [2,]    0    0    1   -1    0
## [3,]    0    0    0    3    0
## [4,]    1    0    3    1    1
## [5,]    0    0    0    2    0

Step 4 - Subtract 2 * Row 4 from Row 1

In this step, we see that rows 3 and 5 of this matrix are linearly dependent. This confirms that the determinant of the matrix is zero, but we will continue with row operations until the matrix is triangular.

##      [,1] [,2] [,3] [,4] [,5]
## [1,]    0    1   -5   -2   -1
## [2,]    0    0    1   -1    0
## [3,]    0    0    0    3    0
## [4,]    1    0    3    1    1
## [5,]    0    0    0    2    0

Step 5 - Subtract 1.5 * Row 5 from Row 3

##      [,1] [,2] [,3] [,4] [,5]
## [1,]    0    1   -5   -2   -1
## [2,]    0    0    1   -1    0
## [3,]    0    0    0    0    0
## [4,]    1    0    3    1    1
## [5,]    0    0    0    2    0

Step 6 - Flip Row Order

Here, we flip the order of the rows to obtain a triangular matrix. Since diagonal contains a zero, this confirms that the determinant of this 5x5 matrix is zero.

##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    0    3    1    1
## [2,]    0    1   -5   -2   -1
## [3,]    0    0    1   -1    0
## [4,]    0    0    0    2    0
## [5,]    0    0    0    0    0

Confirmation

The determinant of the matrix is 0 (confirmed using det).

## [1] 0