Every way to compute a determinant
Cofactor expansion, row reduction, the triangular shortcut, and what the number actually means geometrically.
For a 2x2 or 3x3, use the direct formula — it's fastest. For anything triangular (or triangularized), read the determinant straight off the diagonal. For a general n x n, row-reduce to triangular form and track the sign flips and scaling from each operation; that beats cofactor expansion for anything bigger than 4x4. Cofactor expansion is the definition everything else is proved from, and it's still the right tool when a row or column is mostly zeros.
Small cases — direct formulas
The general definition
Expand along any row or column — the definition that works for every size.
Let A be an n \times n matrix with entries a_{ij}, and for each i, j let M_{ij} denote the minor — the determinant of the (n-1)\times(n-1) submatrix obtained by deleting row i and column j of A — and let C_{ij} = (-1)^{i+j} M_{ij} denote the corresponding cofactor. Then for any fixed row i, \det(A) = \sum_{j=1}^n a_{ij} C_{ij} = \sum_{j=1}^n (-1)^{i+j} a_{ij} M_{ij}, and for any fixed column j, \det(A) = \sum_{i=1}^n a_{ij} C_{ij} = \sum_{i=1}^n (-1)^{i+j} a_{ij} M_{ij}.
The formal cofactor-expansion statement.
Show proof
Start from the Leibniz definition of the determinant as a sum over every permutation \sigma of \{1, \dots, n\}: \det(A) = \sum_{\sigma \in S_n} \operatorname{sgn}(\sigma) \prod_{k=1}^n a_{k,\sigma(k)}. Fix a row i and sort this sum by which column each permutation sends row i to. Every \sigma \in S_n satisfies \sigma(i) = j for exactly one j \in \{1, \dots, n\}, so the sum splits cleanly into n disjoint groups: \det(A) = \sum_{j=1}^n \sum_{\substack{\sigma \in S_n \\ \sigma(i)=j}} \operatorname{sgn}(\sigma) \prod_{k=1}^n a_{k,\sigma(k)}. In the inner sum, every term already carries the factor a_{i,\sigma(i)} = a_{ij}, which does not depend on \sigma beyond fixing \sigma(i) = j, so it factors out: \det(A) = \sum_{j=1}^n a_{ij} \left( \sum_{\substack{\sigma \in S_n \\ \sigma(i)=j}} \operatorname{sgn}(\sigma) \prod_{k \neq i} a_{k,\sigma(k)} \right). The claim is that the bracketed sum is exactly the cofactor C_{ij}. Each permutation \sigma with \sigma(i) = j restricts to a bijection between the remaining n-1 row indices \{1,\dots,n\}\setminus\{i\} and the remaining n-1 column indices \{1,\dots,n\}\setminus\{j\} — call this restricted map \tau. Relabeling those two index sets in increasing order identifies \tau with a permutation \bar\tau of \{1, \dots, n-1\}, and the product \prod_{k \neq i} a_{k,\sigma(k)} becomes exactly the corresponding product of entries of the submatrix obtained by deleting row i and column j — the submatrix whose determinant is M_{ij}. Summing \operatorname{sgn}(\bar\tau) \prod \bar\tau\text{-entries} over all such \bar\tau gives M_{ij} itself, provided the signs match up: that \operatorname{sgn}(\sigma) = (-1)^{i+j} \operatorname{sgn}(\bar\tau).
To see the sign correction, compare \sigma to the permutation \bar\tau extended back to \{1,\dots,n\} by sending i \mapsto j in the "obvious" position. Moving row i up to row 1 by swapping it past the i-1 rows above it takes i - 1 transpositions; moving column j left to column 1 by the same process takes j - 1 transpositions. Each such adjacent swap flips the sign of a permutation by -1, so relating \sigma's sign to \bar\tau's sign (computed on the un-shifted remaining indices) costs a factor of (-1)^{(i-1)+(j-1)} = (-1)^{i+j}. Hence \sum_{\substack{\sigma \in S_n \\ \sigma(i)=j}} \operatorname{sgn}(\sigma) \prod_{k \neq i} a_{k,\sigma(k)} = (-1)^{i+j} M_{ij} = C_{ij}. Substituting back gives the row-i expansion \det(A) = \sum_{j=1}^n a_{ij} C_{ij}. The column-j expansion follows by the identical argument applied to A^T, using \det(A) = \det(A^T) and the fact that transposing swaps the roles of rows and columns (and swaps M_{ij} \leftrightarrow M_{ji}, while (-1)^{i+j} = (-1)^{j+i} is unaffected).
Sanity check: for n = 2, expanding along row 1 gives \det(A) = a_{11}C_{11} + a_{12}C_{12} = a_{11}(a_{22}) - a_{12}(a_{21}) = a_{11}a_{22} - a_{12}a_{21} — the familiar 2\times 2 determinant formula, since each 1\times 1 minor is just the surviving entry itself.
Term
minor
Term
cofactor
Row reduction — the practical method for larger matrices
The triangular shortcut
What the number means
Zero determinant means the matrix is singular.