# Laplace expansion

In linear algebra, the **Laplace expansion**, named after Pierre-Simon Laplace, also called **cofactor expansion**, is an expression of the determinant of an *n* × *n* matrix B as a weighted sum of minors, which are the determinants of some (*n* − 1) × (*n* − 1) submatrices of B. Specifically, for every i,

The Laplace expansion is often useful in proofs, as in, for example, allowing recursion on the size of matrices. It is also of didactic interest for its simplicity, and as one of several ways to view and compute the determinant. For large matrices, it quickly becomes inefficient to compute, when compared to Gaussian elimination.

The determinant of this matrix can be computed by using the Laplace expansion along any one of its rows or columns. For instance, an expansion along the first row yields:

It is easy to verify that the result is correct: the matrix is singular because the sum of its first and third column is twice the second column, and hence its determinant is zero.

As above, it is easy to verify that the result is correct: the matrix is singular because the sum of its first and third column is twice the second column, and hence its determinant is zero.

The Laplace expansion is computationally inefficient for high dimension matrices, with a time complexity in big O notation of *O*(*n*!). Alternatively, using a decomposition into triangular matrices as in the LU decomposition can yield determinants with a time complexity of *O*(*n*^{3}).^{[1]} The following Python code implements Laplace expansion recursively^{[citation needed]}: