Finding the determinant of a $4\times4$ matrix
How does one find the determinant of a $4\times 4$ matrix? I am using Cramer's rule to solve a system of linear equations but don't know how to find the determinant of a $4\times 4$ matrix. Our matrix is with variables and not actual values so the answer will be in terms of the variables. Is there a rule/formula that I can use to get the determinant without using co-factor expansion?
The matrix given is
\begin{bmatrix} 1 & 1 & -2 & 3 \\ 3 & 1 &-6 & 8 \\ 0 & 7 & 3 & 0 \\ -1 & 8 & 7 & -4 \end{bmatrix}
, but then to use cramers rule and then to find the subsequent determinants the matrix will change? so was hoping for a general formula?
$\endgroup$ 42 Answers
$\begingroup$When using Cramer's rule, there will be no variables whatsoever, rather, you know that the coordinates of the solution to $Ax=b$ are given by $$x_i=\frac{\det{(A\mid i)}}{\det A}$$ where $(A|i)$ is the matrix obtained by replacing $A$'s $i-th$ column with the column vector $b$. I give you an example on how to compute $\det A$, and maybe you can compute the remaining determinants yourself. Recall how how the detereminant behaves:
$({\rm i})$ It remains unchanged if we sum a multiple of a row (column) to another row (column)
$(\rm ii)$ It changes sign if we permute two rows (columns)
$(\rm iii)$ Scalars hop off the determinant.
Thus you may partially triagulate your matrix and operate as follows $$\begin{align} \det \left( {\begin{matrix} 1 & 1 & { - 2} & 3 \\ 0 & { - 2} & 0 & { - 1} \\ 0 & 7 & 3 & 0 \\ 0 & 9 & 5 & { - 1} \\ \end{matrix} } \right) &= - \det \left( {\begin{matrix} 1 & 1 & { - 2} & 3 \\ 0 & 2 & 0 & 1 \\ 0 & 7 & 3 & 0 \\ 0 & 9 & 5 & { - 1} \\ \end{matrix} } \right) \cr \text{cofactor} &= - \det \left( {\begin{matrix} 2 & 0 & 1 \\ 7 & 3 & 0 \\ 9 & 5 & { - 1} \\ \end{matrix} } \right) \cr R_2-3R_1\to R_2'\;,R_3-9R'_2\to R_3'\;\; &= - \det \left( {\begin{matrix} 0 & { - 6} & 7 \\ 1 & 3 & { - 3} \\ 0 & { - 22} & {26} \\ \end{matrix} } \right) \cr \text{ permute rows } &= \det \left( {\begin{matrix} 1 & 3 & { - 3} \\ 0 & { - 6} & 7 \\ 0 & { - 22} & {26} \\ \end{matrix} } \right) \cr \text{ cofactor } &= \det \left( {\begin{matrix} { - 6} & 7 \\ { - 22} & {26} \\ \end{matrix} } \right) = - 2 \end{align} $$
You can also triangulate it, and just calculate $\prod a_{ii}$ which is almost what I did above. Here is W|A's computation.
ADD There is a formula that does not involve cofactors, but it involves $4!=24$ terms, namely $$\det A=\sum_{\sigma \in S_4}\operatorname{sgn}\sigma a_{1\sigma(1)}\cdots a_{n\sigma(n)}$$
$\endgroup$ $\begingroup$A "quick" method to compute the determinant of a $4 \times 4$ matrix by hand, is by using cofactor expansion.
Let $ D = \begin{pmatrix} 1 & 1 & -2 & 3 \\ 3 & 1 &-6 & 8 \\ 0 & 7 & 3 & 0 \\ -1 & 8 & 7 & -4 \end{pmatrix}$
Here we are going to choose which row/column contains the most $0$'s Clearly, row 3 contains the most. So we will exand along that row.
Start with the first term in row three, which is $0$ and multiply it to the $(n-1) \times (n-1)$ sub-matrix $M$, which you can obtain by covering up the column and rows that intersect at the term. Which should look like this:
$0 \cdot \begin{pmatrix} 1 & -2 & 3 \\ 1 &-6 & 8 \\ 8 & 7 & -4 \end{pmatrix}$
As you can see, we can obtain a $3 \times 3$ matrix containing all original entries of our $4 \times 4$ matrix, excluding those from column 1 and row 2.
Now, we repeat this process for the remain terms in row three: $7,3,0$:
$\text{det}(D) =$
$ 0 \cdot \begin{pmatrix} 1 & -2 & 3 \\ 1 &-6 & 8 \\ 8 & 7 & -4 \end{pmatrix} $ $- 7 \cdot \begin{pmatrix} 1 & -2 & 3 \\ 3 &-6 & 8 \\ -1 & 7 & -4 \end{pmatrix} +$ $ 3 \cdot \begin{pmatrix} 1 & 1 & 3 \\ 3 & 1 & 8 \\ -1 & 8 & -4 \end{pmatrix} - $ $0 \begin{pmatrix} 1 & 1 & -2 \\ 3 & 1 &-6 \\ -1 & 8 & 7 \end{pmatrix}$
The matrices being mutliplied by $0$ can be discarded. So we are left with:
$\text{det}(D) = - 7 \cdot \begin{pmatrix} 1 & -2 & 3 \\ 3 &-6 & 8 \\ -1 & 7 & -4 \end{pmatrix}+$ $ 3 \cdot \begin{pmatrix} 1 & 1 & 3 \\ 3 & 1 & 8 \\ -1 & 8 & -4 \end{pmatrix}$
Expanding along row 1 in both resulting $3 \times 3$ matrices and we get:
$\text{det}(D) =$
$ -7 \cdot \{\begin{pmatrix} -6 & 8 \\ 7 & -4 \end{pmatrix} + $ $2 \cdot \begin{pmatrix} 3 & 8 \\ -1 & -4 \end{pmatrix} + $ $3 \cdot \begin{pmatrix} 3 &-6 \\ 8 & 7 \end{pmatrix}\} + $
$ 3 \cdot \{ \begin{pmatrix} 1 & 8 \\ 8 & -4 \end{pmatrix} - $ $\begin{pmatrix} 3 & 8 \\ -1 & -4 \end{pmatrix} + $ $ 3 \cdot \begin{pmatrix} 3 & 1 \\ -1 & 8 \end{pmatrix}\}$
Now all you have left is to comupute six $2 \times 2$ matrices.
As far as computing this with variables, the same principles of cofactor expansion can be applied. Just determine which row/column contains the most $0$'s (if any) and expand along that row.
$\endgroup$ 2