Determinant formulas by matrix size
For 2×2 matrices: det([[a,b],[c,d]]) = ad - bc. For 3×3 matrices, the Sarrus rule or cofactor expansion gives: det = a(ei-fh) - b(di-fg) + c(dh-eg) for matrix [[a,b,c],[d,e,f],[g,h,i]].
For larger matrices, cofactor expansion along any row or column works: det(A) = Σ(-1)^(i+j) × a_ij × M_ij, where M_ij is the minor (determinant of the submatrix obtained by deleting row i and column j).
The computational cost grows factorially with matrix size using cofactor expansion — O(n!) — making it impractical for large matrices. LU decomposition computes determinants in O(n³) by expressing A = LU and using det(A) = det(L) × det(U) = product of diagonal elements.