Linear Algebra Problem DM.C28

Doing the computations by hand, find the determinant of the matrix A.

Definition DM Determinant of a Matrix Suppose A is a square matrix.

\[ \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{bmatrix} \]

Then its determinant is:

A = a(ei - fh) - b(di - fg) + c(dh - eg)

First let’s find the determinant using the det() function.

A <- matrix(c(1,0,1,1,2,-1,-1,1,2,5,3,0,1,-1,0,1), nrow = 4, byrow = TRUE)
print(A)
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    1    1
## [2,]    2   -1   -1    1
## [3,]    2    5    3    0
## [4,]    1   -1    0    1
det(A)
## [1] 7.771561e-16
round(det(A))
## [1] 0

And now by hand:

The pattern for 4×4 matrices:

Now to calculate the determinant:

\[ \begin{bmatrix} 1 & 0 & 1 & 1\\ 2 & -1 & -1 & 1 \\ 2 & 5 & 3 & 0 \\ 1 & -1 & 0 & 1 \\ \end{bmatrix} = \begin{bmatrix} -1 & -1 & 1 \\ 5 & 3 & 0 \\ -1 & 0 & 1 \\ \end{bmatrix} - 0 + \begin{bmatrix} 2 & -1 & 1 \\ 2 & 5 & 0 \\ 1 & -1 & 1 \\ \end{bmatrix} - \begin{bmatrix} 2 & -1 & -1 \\ 2 & 5 & 3 \\ 1 & -1 & 0 \\ \end{bmatrix} \]

detA = (1*(-1*(3*1 - 0*0) - -1*(5*1 - 0*-1) + 1*(5*0 - 3*-1)) 
        - 0 
        +1*(2*(5*1 - 0*-1) - -1*(2*1 - 0*1) + 1*(2*-1 - 5*1))
        -1*( 2*(5*0 - 3*-1)- -1*(2*0 - 3*1) + -1*(2*-1 - 5*1)))
detA
## [1] 0