For AI agents: use /llms.txt for the Nakafa content index.
Cramer's rule is a method for solving systems of linear equations using determinants. This method provides a direct way to calculate solutions of linear equation systems when the coefficient matrix is invertible.
This method is very useful for understanding the relationship between determinants and solutions of linear systems, although it is computationally less efficient compared to Gaussian elimination for large systems.
Before discussing Cramer's rule, we need to understand the concept of complementary matrix which forms the basis of this method.
For matrix A∈Rn×n, the complementary matrix is defined as:
Note that the indices in Aji are swapped (not Aij).
The complementary matrix A~ is a matrix consisting of cofactors of matrix A, but with transposed positions.
The complementary matrix has the following structure:
Each element is calculated by taking the determinant of the corresponding submatrix, then given a sign based on the checkerboard pattern (−1)i+j.
One of the most important properties of the complementary matrix is its relationship with the original matrix:
This property is very important because it provides a direct relationship between the matrix, its complementary matrix, and its determinant.
From the fundamental property above, we can derive the matrix inverse formula using the complementary matrix.
If matrix A∈Rn×n is invertible, then:
However, calculating matrix inverse using this formula is much less efficient compared to Gaussian elimination for large matrices.
Its complementary matrix is:
Now we can formulate Cramer's rule for solving systems of linear equations.
Let A∈Rn×n be an invertible matrix and a1,a2,…,an∈Rn be the columns of A. For vector b∈Rn, the solution x∈Rn of the linear equation system A⋅x=b is given by:
for j=1,2,…,n.
To calculate the j-th component of solution x, we replace the j-th column of matrix A with vector b, then calculate the determinant of this modified matrix and divide it by the determinant of the original matrix A.
The proof of Cramer's rule uses Laplace expansion and properties of the complementary matrix.
For j=1,…,n:
based on Laplace expansion with respect to the j-th column.
Let's look at a concrete example of applying Cramer's rule:
matrix A is invertible and the system has a unique solution.
According to Cramer's rule:
Verification shows that A⋅x−b=0.
If A∈Zn×n is an invertible matrix with integer elements and b∈Zn is a vector with integer elements, then the elements of the inverse A−1 and solution x of the system A⋅x=b are rational numbers with denominator that (if not reduced) equals ∣detA∣.
This occurs because determinant calculation only involves addition, subtraction, and multiplication operations, so the determinant of an integer matrix is always an integer. In the inverse formula and Cramer's rule, the only division operation is division by detA.