In linear algebra, Cramer's rule is an explicit formula for the solution of a system of linear equations with as many equations as unknowns, valid whenever the system has a unique solution. It expresses the solution in terms of the determinants of the (square) coefficient matrix and of matrices obtained from it by replacing one column by the column vector of right-sides of the equations. It is named after Gabriel Cramer, who published the rule for an arbitrary number of unknowns in 1750, although Colin Maclaurin also published special cases of the rule in 1748, and possibly knew of it as early as 1729.
General case Consider a system of n linear equations for n unknowns, represented in matrix multiplication form as follows:
A𝐱=𝐛 where the n × n matrix A has a nonzero determinant, and the vector 𝐱=(x1,…,xn)𝖳 is the column vector of the variables. Then the theorem states that in this case the system has a unique solution, whose individual values for the unknowns are given by:
xi=det(Ai)det(A)i=1,…,n where Ai is the matrix formed by replacing the i-th column of A by the column vector b. A more general version of Cramer's rule considers the matrix equation
AX=B where the n × n matrix A has a nonzero determinant, and X, B are n × m matrices. Given sequences 1≤i1<i2<⋯<ik≤n and 1≤j1<j2<⋯<jk≤m, let XI,J be the k × k submatrix of X with rows in I:=(i1,…,ik) and columns in J:=(j1,…,jk). Let AB(I,J) be the n × n matrix formed by replacing the is column of A by the js column of B, for all s=1,…,k. Then
detXI,J=det(AB(I,J))det(A). In the case k=1, this reduces to the normal Cramer's rule. The rule holds for systems of equations with coefficients and unknowns in any field, not just in the real numbers.
Proof The proof for Cramer's rule uses the following properties of the determinants: linearity with respect to any given column and the fact that the determinant is zero whenever two columns are equal, which is implied by the property that the sign of the determinant flips if you switch two columns. Fix the index j of a column, and consider that the entries of the other columns have fixed values. This makes the determinant a function of the entries of the jth column. Linearity with respect to this column means that this function has the form
Dj(a1,j,…,an,j)=C1,ja1,j+⋯,Cn,jan,j, where the Ci,j are coefficients that depend on the entries of A that are not in column j. So, one has
det(A)=Dj(a1,j,…,an,j)=C1,ja1,j+⋯,Cn,jan,j (Laplace expansion provides a formula for computing the Ci,j but their expression is not important here.) If the function Dj is applied to any other column k of A, then the result is the determinant of the matrix obtained from A by replacing column j by a copy of column k, so the resulting determinant is 0 (the case of two equal columns). Now consider a system of n linear equations in n unknowns x1,…,xn, whose coefficient matrix is A, with det(A) assumed to be nonzero:
a11x1+a12x2+⋯+a1nxn=b1a21x1+a22x2+⋯+a2nxn=b2⋮an1x1+an2x2+⋯+annxn=bn. If one combines these equations by taking C1,j times the first equation, plus C2,j times the second, and so forth until Cn,j times the last, then for every k the resulting coefficient of xk becomes
Dj(a1,k,…,an,k). So, all coefficients become zero, except the coefficient of xj, which becomes det(A). Similarly, the constant coefficient becomes Dj(b1,…,bn), and the resulting equation is thus
det(A)xj=Dj(b1,…,bn), which gives the value of xj as
xj=1det(A)Dj(b1,…,bn). As, by construction, the numerator is the determinant of the matrix obtained from A by replacing column j by b, we get the expression of Cramer's rule as a necessary condition for a solution. It remains to prove that these values for the unknowns form a solution. Let M be the n × n matrix that has the coefficients of Dj as jth row, for j=1,…,n (this is the adjugate matrix for A). Expressed in matrix terms, we have thus to prove that
𝐱=1det(A)M𝐛 is a solution; that is, that
A(1det(A)M)𝐛=𝐛. For that, it suffices to prove that
A(1det(A)M)=In, where In is the identity matrix. The above properties of the functions Dj show that one has MA = det(A)In, and therefore,
(1det(A)M)A=In. This completes the proof, since a left inverse of a square matrix is also a right-inverse (see Invertible matrix theorem). For other proofs, see below.
Finding inverse matrix
Let A be an n × n matrix with entries in a field F. Then
Aadj(A)=adj(A)A=det(A)I where adj(A) denotes the adjugate matrix, det(A) is the determinant, and I is the identity matrix. If det(A) is nonzero, then the inverse matrix of A is
A−1=1det(A)adj(A). This gives a formula for the inverse of A, provided det(A) ≠ 0. In fact, this formula works whenever F is a commutative ring, provided that det(A) is a unit. If det(A) is not a unit, then A is not invertible over the ring (it may be invertible over a larger ring in which some non-unit elements of F may be invertible).
Applications
Explicit formulas for small systems Consider the linear system
{a1x+b1y=c1a2x+b2y=c2 which in matrix format is
[a1b1a2b2][xy]=[c1c2]. Assume a1b2 − b1a2 is nonzero. Then, with the help of determinants, x and y can be found with Cramer's rule as
x=|c1b1c2b2||a1b1a2b2|=c1b2−b1c2a1b2−b1a2,y=|a1c1a2c2||a1b1a2b2|=a1c2−c1a2a1b2−b1a2. The rules for 3 × 3 matrices are similar. Given
{a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3 which in matrix format is
[a1b1c1a2b2c2a3b3c3][xyz]=[d1d2d3]. Then the values of x, y and z can be found as follows:
x=|d1b1c1d2b2c2d3b3c3||a1b1c1a2b2c2a3b3c3|,y=|a1d1c1a2d2c2a3d3c3||a1b1c1a2b2c2a3b3c3|,z=|a1b1d1a2b2d2a3b3d3||a1b1c1a2b2c2a3b3c3|.
Differential geometry
Ricci calculus Cramer's rule is used in the Ricci calculus in various calculations involving the Christoffel symbols of the first and second kind. In particular, Cramer's rule can be used to prove that the divergence operator on a Riemannian manifold is invariant with respect to change of coordinates. We give a direct proof, suppressing the role of the Christoffel symbols. Let (M,g) be a Riemannian manifold equipped with local coordinates (x1,x2,…,xn). Let A=Ai∂∂xi be a vector field. We use the summation convention throughout.
Theorem. The divergence of A, divA=1detg∂∂xi(Aidetg), is invariant under change of coordinates.
Computing derivatives implicitly Consider the two equations F(x,y,u,v)=0 and G(x,y,u,v)=0. When u and v are independent variables, we can define x=X(u,v) and y=Y(u,v). An equation for ∂x∂u can be found by applying Cramer's rule.
… excerpt ends here. Continue reading the full article.

