maths2u
Tier
⌕ Search ⌘K
Theorem

Cramer's rule

T-020Home MU-103Threads structure
Statement

Let \( F \) be a field, \( n \in \mathbb{N} \), \( n \geq 1 \), and let \( A \in F^{n \times n} \) be a square matrix with columns \( a_1, \dots, a_n \). Let \( b \in F^n \). If \( \det A \neq 0 \), then the linear system \( Ax = b \) has exactly one solution \( x = (x_1, \dots, x_n)^{\mathsf{T}} \in F^n \), and its coordinates are given by \[ x_i \;=\; \frac{\det A_i(b)}{\det A}, \qquad i = 1, \dots, n, \] where \( A_i(b) := (a_1, \dots, a_{i-1}, \, b, \, a_{i+1}, \dots, a_n) \) is the matrix obtained from \( A \) by replacing its \( i \)-th column with \( b \).

Why it matters

Cramer's rule closes the loop between two of the pillars of first-year linear algebra: it expresses the solution of a nonsingular square system entirely in terms of determinants. The value is chiefly structural rather than computational: it shows that each coordinate \( x_i \) of the solution is a ratio of two polynomial expressions in the entries of \( A \) and \( b \). From this single observation one reads off, for free, that solutions depend continuously — indeed rationally, hence smoothly — on the data, that integer systems with unimodular matrices have integer solutions, and that the inverse matrix has the explicit adjugate form \( A^{-1} = (\det A)^{-1} \operatorname{adj} A \).

It is also the prototype of a phenomenon that recurs throughout algebra: an existence-and-uniqueness statement upgraded to a closed formula. The same determinant identity, read over a commutative ring instead of a field, drives the adjugate identity \( (\operatorname{adj} A) A = (\det A) I_n \), the determinant trick behind the Cayley–Hamilton theorem, and Nakayama's lemma.

Hypotheses
Hypothesis (squareness): \( A \in F^{n\times n} \).For a non-square coefficient matrix the determinant is undefined and no ratio formula can exist. The \( 1 \times 2 \) system \( x_1 + x_2 = 1 \) over \( \mathbb{R} \) has infinitely many solutions \( (t, 1-t) \); no assignment of "determinants" singles one out.
Hypothesis (nonsingularity): \( \det A \neq 0 \).Take \( A = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \), \( b = \begin{pmatrix} 1 \\ 2 \end{pmatrix} \). Then \( \det A = 0 \) while \( \det A_1(b) = \det \begin{pmatrix} 1 & 1 \\ 2 & 1 \end{pmatrix} = -1 \neq 0 \): the formula would demand \( 0 \cdot x_1 = -1 \), and indeed the system has no solution at all. With \( b = (1,1)^{\mathsf{T}} \) the same \( A \) gives infinitely many solutions — either way the ratio \( \det A_i(b) / \det A \) is meaningless.
Hypothesis (scalars form a field).Over the ring \( \mathbb{Z} \), the system \( 2x = 1 \) has \( \det A = 2 \neq 0 \), yet no solution exists in \( \mathbb{Z} \): division by \( \det A \) requires \( \det A \) to be invertible in the scalar ring, which nonzero elements of a field always are but nonzero ring elements need not be. Over any commutative ring the weaker identity \( (\det A)\, x_i = \det A_i(b) \) still holds for every solution \( x \) (see Problem 5), and the full rule survives exactly when \( \det A \) is a unit. Over \( \mathbb{Z}/6\mathbb{Z} \), the equation \( 2x = 2 \) has the two solutions \( x = 1 \) and \( x = 4 \): here \( \det A = 2 \) is nonzero but a zero divisor, and uniqueness fails.
Proof

Throughout, \( a_1, \dots, a_n \in F^n \) denote the columns of \( A \), so \( A = (a_1 \mid \cdots \mid a_n) \).

1
\( \det A \neq 0 \;\Longrightarrow\; A \) is invertible.
Determinant criterion for invertibility: for \( A \in F^{n \times n} \) over a field, \( A \) is invertible if and only if \( \det A \neq 0 \). This follows from the adjugate identity \( (\operatorname{adj} A)\, A = A \,(\operatorname{adj} A) = (\det A) I_n \), proved by column cofactor expansion, since \( (\det A)^{-1} \operatorname{adj} A \) is then a two-sided inverse. A
2
The vector \( x := A^{-1} b \) satisfies \( Ax = b \), and it is the only solution: if \( Ay = b \) then \( y = A^{-1}(Ay) = A^{-1} b = x \).
Existence: \( A(A^{-1}b) = (A A^{-1}) b = I_n b = b \) by associativity of matrix multiplication. Uniqueness: left-multiply \( Ay = b \) by \( A^{-1} \). This settles existence and uniqueness; it remains to derive the formula for the coordinates of \( x \). A
3
\[ b \;=\; Ax \;=\; \sum_{j=1}^{n} x_j \, a_j . \]
Definition of the matrix–vector product: \( Ax \) is the linear combination of the columns of \( A \) with coefficients the entries of \( x \). A
4
\[ \det A_i(b) \;=\; \det A_i\!\left( \sum_{j=1}^{n} x_j a_j \right) \;=\; \sum_{j=1}^{n} x_j \, \det A_i(a_j). \]
Multilinearity of the determinant: \( \det \) is \( F \)-linear in each column separately when the remaining columns are held fixed. Here only the \( i \)-th column varies, and we substitute the expansion of \( b \) from Step 3 into that slot. This is the key move: it transfers the unknown coefficients \( x_j \) outside the determinants. B
5
For every \( j \neq i \): \( \det A_i(a_j) = 0 \).
Alternating property of the determinant: a matrix with two equal columns has determinant \( 0 \). Indeed, for \( j \neq i \) the matrix \( A_i(a_j) = (a_1, \dots, a_{i-1}, a_j, a_{i+1}, \dots, a_n) \) carries the vector \( a_j \) in both its \( i \)-th and its \( j \)-th column. Care is needed here: "alternating" (equal columns give \( 0 \)) must be taken as the defining property, not derived from antisymmetry under column swaps — over a field of characteristic \( 2 \), antisymmetry \( \det(\dots u \dots v \dots) = -\det(\dots v \dots u \dots) \) is vacuous ( \( +1 = -1 \) ), while the alternating property still holds, as one checks directly from the Leibniz formula \( \det M = \sum_{\sigma \in S_n} \operatorname{sgn}(\sigma) \prod_k m_{\sigma(k),k} \) by pairing each permutation \( \sigma \) with \( \sigma \circ (i\; j) \). C
6
For \( j = i \): \( A_i(a_i) = A \), hence \( \det A_i(a_i) = \det A \). Combining with Steps 4–5: \[ \det A_i(b) \;=\; x_i \det A. \]
Replacing the \( i \)-th column of \( A \) by its own \( i \)-th column changes nothing, so \( A_i(a_i) = A \) by inspection. In the sum of Step 4 every term with \( j \neq i \) vanishes by Step 5, leaving only the \( j = i \) term. B
7
\[ x_i \;=\; \frac{\det A_i(b)}{\det A}, \qquad i = 1, \dots, n. \]
Since \( F \) is a field and \( \det A \neq 0 \), the scalar \( \det A \) has a multiplicative inverse in \( F \); multiply the identity of Step 6 by \( (\det A)^{-1} \). As \( i \) was arbitrary, this determines every coordinate of the unique solution \( x \). \( \blacksquare \) A
Result
\[ \det A \neq 0 \;\Longrightarrow\; Ax = b \text{ has the unique solution } \; x_i = \frac{\det A_i(b)}{\det A}, \quad i = 1, \dots, n. \]

Reading. When the coefficient matrix of a square system is nonsingular, each unknown is a ratio of two determinants: the denominator is always \( \det A \), and the numerator is \( \det A \) with the column of that unknown's coefficients swapped out for the right-hand side. Geometrically, over \( \mathbb{R} \), \( x_i \) is the ratio of two signed volumes: the volume of the parallelepiped spanned by the columns of \( A \) with \( a_i \) replaced by \( b \), divided by the volume spanned by the columns themselves — it is the \( i \)-th coordinate of \( b \) in the basis \( (a_1, \dots, a_n) \).

Scope. Applies to square systems \( n \times n \) over any field \( F \) (including \( \mathbb{Q} \), \( \mathbb{R} \), \( \mathbb{C} \), finite fields, function fields), provided \( \det A \neq 0 \). Over a commutative ring \( R \) the identity \( (\det A)\,x_i = \det A_i(b) \) holds for every solution, and the full rule holds if and only if \( \det A \) is a unit of \( R \). It says nothing about singular or non-square systems, and it is not a practical numerical algorithm for large \( n \).

Corollaries & converses
  • Adjugate inverse formula. Solving \( A c_j = e_j \) column by column gives \( (A^{-1})_{ij} = C_{ji} / \det A \), i.e. \( A^{-1} = (\det A)^{-1} \operatorname{adj} A \), where \( C_{ji} \) is the \( (j,i) \) cofactor (Problem 4).
  • Unimodular systems. If \( A \in \mathbb{Z}^{n \times n} \) with \( \det A = \pm 1 \) and \( b \in \mathbb{Z}^n \), the unique solution is integral; equivalently, \( A^{-1} \in \mathbb{Z}^{n\times n} \) exactly when \( \det A = \pm 1 \) — the defining condition of \( \mathrm{GL}_n(\mathbb{Z}) \) (Problem 3).
  • Regularity of the solution map. On the open set \( \{ (A, b) : \det A \neq 0 \} \subseteq \mathbb{R}^{n^2 + n} \), the map \( (A,b) \mapsto A^{-1} b \) is a rational function of the entries with nonvanishing denominator, hence \( C^\infty \) and even real-analytic. This is the standard route to smooth dependence in the inverse and implicit function theorems.
  • Converse — holds. If \( Ax = b \) has a unique solution for even one \( b \in F^n \), then \( \ker A = \{0\} \), so the square matrix \( A \) is invertible and \( \det A \neq 0 \). Thus nonsingularity is exactly equivalent to unique solvability (for one \( b \), or for all \( b \)).
  • No converse for mere existence. Existence of some solution does not force \( \det A \neq 0 \): the system \( \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} x = \begin{pmatrix} 2 \\ 2 \end{pmatrix} \) is solvable (e.g. \( x = (1,1)^{\mathsf{T}} \)) with \( \det A = 0 \).
Fails without
  • Drop \( \det A \neq 0 \) (inconsistent case). \( A = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \), \( b = \begin{pmatrix} 1 \\ 2 \end{pmatrix} \): here \( \det A = 0 \) but \( \det A_1(b) = -1 \neq 0 \). The identity \( (\det A)x_1 = \det A_1(b) \) would read \( 0 = -1 \), confirming that no solution exists; the ratio formula is undefined.
  • Drop \( \det A \neq 0 \) (underdetermined case). Same \( A \) with \( b = \begin{pmatrix} 1 \\ 1 \end{pmatrix} \): every \( x = (t, 1-t)^{\mathsf{T}} \) solves the system. All the determinants \( \det A, \det A_1(b), \det A_2(b) \) vanish, and the formula \( 0/0 \) selects nothing — uniqueness genuinely fails, it is not a defect of the formula.
  • Drop the field hypothesis. Over \( \mathbb{Z} \): \( 2x = 1 \) has \( \det A = 2 \neq 0 \) yet no integer solution, since \( 2 \) is not a unit of \( \mathbb{Z} \). Over \( \mathbb{Z}/6\mathbb{Z} \): \( 2x = 2 \) has the distinct solutions \( x = 1 \) and \( x = 4 \), so uniqueness fails when \( \det A \) is a nonzero zero divisor.
  • Drop squareness. For \( A = (1 \;\; 1) \in \mathbb{R}^{1 \times 2} \), \( b = (1) \): infinitely many solutions and no determinant exists to form any ratio.
Common errors
  • Row/column confusion. Replacing the \( i \)-th row of \( A \) by \( b^{\mathsf{T}} \) instead of the \( i \)-th column by \( b \). (By \( \det A = \det A^{\mathsf{T}} \) a transposed version exists, but mixing the two conventions mid-calculation gives wrong answers.)
  • The 0/0 fallacy. Concluding from \( \det A = 0 \) and \( \det A_i(b) = 0 \) for all \( i \) that the system has infinitely many solutions. False: for \( A = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix} \), \( b = (0,1,0)^{\mathsf{T}} \), all four determinants vanish yet the second equation reads \( 0 = 1 \): no solution. The vanishing of all \( n+1 \) determinants is necessary for solvability in the singular case but not sufficient.
  • Forgetting the nonsingularity check. Computing the ratios first and checking \( \det A \) last (or never). The denominator must be verified nonzero before any division is legitimate.
  • Cofactor transpose slip. When passing to the corollary \( A^{-1} = (\det A)^{-1}\operatorname{adj} A \), writing \( (A^{-1})_{ij} = C_{ij}/\det A \) instead of the correct \( C_{ji}/\det A \): the adjugate is the transpose of the cofactor matrix.
  • Treating it as an algorithm. Using Cramer's rule to solve \( n \times n \) systems for \( n \) beyond about \( 3 \): via cofactor expansion the cost is \( \mathcal{O}((n+1)!) \), and even computing each of the \( n+1 \) determinants by elimination costs more than solving the whole system once by Gaussian elimination at \( \mathcal{O}(n^3) \). It is a theoretical identity, not a numerical method.
  • Sign errors in \( 3 \times 3 \) cofactor expansions — the single most common source of wrong numerators; expanding along a row or column containing zeros reduces the exposure.
Discussion

The rule is named for Gabriel Cramer, who published it in 1750 in his Introduction à l'analyse des lignes courbes algébriques, where he needed to solve linear systems arising from fitting algebraic curves through prescribed points. Colin Maclaurin had presented equivalent formulas for systems of two and three unknowns in his posthumously published Treatise of Algebra (1748), and the determinant itself traces back further, to Leibniz's letters of the 1690s and to Seki Takakazu in Japan. Cramer's contribution was the general \( n \)-variable pattern — stated, characteristically for the period, without the modern notion of a determinant as an alternating multilinear form; that conceptual reorganisation came in the nineteenth century with Cauchy and was perfected in Weierstrass's axiomatic characterisation of \( \det \) as the unique alternating multilinear form on columns taking the value \( 1 \) at \( I_n \). The seven-step proof above is a direct descendant of that axiomatic viewpoint: it uses nothing about \( \det \) except multilinearity, the alternating property, and the invertibility criterion.

Geometrically, Cramer's rule is a statement about coordinates and volumes. If \( \det A \neq 0 \), the columns \( a_1, \dots, a_n \) form a basis, and solving \( Ax = b \) means expressing \( b \) in that basis. The rule says: the \( i \)-th coordinate of \( b \) is the factor by which the signed volume of the column parallelepiped changes when \( a_i \) is replaced by \( b \). For \( n = 2 \) this is visible by eye — the parallelogram spanned by \( (b, a_2) \) has area \( x_1 \) times that spanned by \( (a_1, a_2) \), because the \( a_2 \)-component of \( b \) shears the parallelogram without changing its area.

The computational status of the rule deserves honesty in both directions. As a general-purpose solver it is dominated by LU factorisation: one elimination at \( \mathcal{O}(n^3) \) yields the whole solution, whereas Cramer's rule requires \( n + 1 \) determinants. Moreover, the textbook implementation can be numerically unstable — the computed ratios may suffer cancellation even for well-conditioned systems, a point analysed in the numerical linear algebra literature. Yet for \( 2 \times 2 \) and \( 3 \times 3 \) systems with symbolic or parametric entries the rule is often the fastest honest route, which is why it earns its keep in variation of parameters (Worked example 2), in classical mechanics, and in deriving closed-form sensitivities \( \partial x_i / \partial a_{jk} \).

The deepest reading is ring-theoretic. The core identity \( (\det A)\, x_i = \det A_i(b) \) — Steps 3–6, which never divide — is a polynomial identity in the entries and hence valid over every commutative ring \( R \). Combined with \( A \operatorname{adj}(A) = (\det A) I_n \), it shows \( A \in \mathrm{GL}_n(R) \iff \det A \in R^\times \), which specialises to \( \mathrm{GL}_n(\mathbb{Z}) = \{ A : \det A = \pm 1 \} \). The same "determinant trick" — multiply by the adjugate rather than divide by the determinant — proves the Cayley–Hamilton theorem over arbitrary commutative rings and powers Nakayama's lemma: if \( M \) is a finitely generated \( R \)-module and \( \varphi : M \to M \) satisfies a suitable containment \( \varphi(M) \subseteq \mathfrak{a} M \), applying the adjugate identity to the matrix of \( \varphi \) produces a monic polynomial relation. Cramer's rule is thus the first appearance of a technique that carries a substantial fraction of commutative algebra. Common misconceptions. (i) "Cramer's rule fails over rings" — the identity holds over every commutative ring; only the division step needs \( \det A \) to be a unit. (ii) "If \( \det A = 0 \) and all numerators vanish, there are infinitely many solutions" — see Common errors for an inconsistent counterexample. (iii) "Cramer's rule is how computers solve linear systems" — production solvers use factorisations; the rule's role is structural.

Worked examples

Example 1 (a \( 3 \times 3 \) system). Solve over \( \mathbb{R} \): \[ \begin{aligned} x_1 + x_2 + x_3 &= 6, \\ x_1 + 2x_2 + 3x_3 &= 14, \\ x_1 + 4x_2 + 9x_3 &= 36. \end{aligned} \]

1
\[ A = \begin{pmatrix} 1 & 1 & 1 \\ 1 & 2 & 3 \\ 1 & 4 & 9 \end{pmatrix}, \qquad b = \begin{pmatrix} 6 \\ 14 \\ 36 \end{pmatrix}, \qquad \det A = 1(18-12) - 1(9-3) + 1(4-2) = 2 \neq 0. \]
Cofactor expansion along the first row. (The matrix is a transposed Vandermonde matrix on the nodes \( 1, 2, 3 \), so \( \det A = (2-1)(3-1)(3-2) = 2 \) confirms the arithmetic.) Since \( \det A \neq 0 \), Cramer's rule applies. A
2
\[ \det A_1(b) = \det \begin{pmatrix} 6 & 1 & 1 \\ 14 & 2 & 3 \\ 36 & 4 & 9 \end{pmatrix} = 6(18-12) - 1(126-108) + 1(56-72) = 36 - 18 - 16 = 2. \]
Replace column 1 of \( A \) by \( b \); expand along the first row. A
3
\[ \det A_2(b) = \det \begin{pmatrix} 1 & 6 & 1 \\ 1 & 14 & 3 \\ 1 & 36 & 9 \end{pmatrix} = 1(126-108) - 6(9-3) + 1(36-14) = 18 - 36 + 22 = 4. \]
Replace column 2 of \( A \) by \( b \); expand along the first row. A
4
\[ \det A_3(b) = \det \begin{pmatrix} 1 & 1 & 6 \\ 1 & 2 & 14 \\ 1 & 4 & 36 \end{pmatrix} = 1(72-56) - 1(36-14) + 6(4-2) = 16 - 22 + 12 = 6. \]
Replace column 3 of \( A \) by \( b \); expand along the first row. A
5
\[ x_1 = \frac{2}{2} = 1, \qquad x_2 = \frac{4}{2} = 2, \qquad x_3 = \frac{6}{2} = 3. \]
Apply the theorem: \( x_i = \det A_i(b) / \det A \). Substituting \( (1,2,3) \) back into all three equations confirms \( 6, 14, 36 \). A
\[ x = (1, \, 2, \, 3)^{\mathsf{T}} \]

Reading. One determinant per unknown plus one for the denominator — four \( 3\times 3 \) determinants in total — delivers the full solution, with the back-substitution check available as a free audit.

Example 2 (variation of parameters — where the rule genuinely earns its keep). Find functions \( u_1(t), u_2(t) \) so that \( y_p = u_1 \cos t + u_2 \sin t \) is a particular solution of \( y'' + y = \sec t \) on \( \left( -\frac{\pi}{2}, \frac{\pi}{2} \right) \). The method of variation of parameters imposes the linear system, at each fixed \( t \), \[ \begin{pmatrix} \cos t & \sin t \\ -\sin t & \cos t \end{pmatrix} \begin{pmatrix} u_1' \\ u_2' \end{pmatrix} = \begin{pmatrix} 0 \\ \sec t \end{pmatrix}. \]

1
\[ \det A = W(t) = \det \begin{pmatrix} \cos t & \sin t \\ -\sin t & \cos t \end{pmatrix} = \cos^2 t + \sin^2 t = 1 \neq 0 \quad \text{for all } t. \]
The coefficient matrix is the Wronskian matrix of the fundamental pair \( \cos t, \sin t \); its determinant is the Wronskian, here identically \( 1 \), so Cramer's rule applies at every \( t \). A
2
\[ u_1' = \frac{1}{W} \det \begin{pmatrix} 0 & \sin t \\ \sec t & \cos t \end{pmatrix} = 0 \cdot \cos t - \sin t \sec t = -\tan t. \]
Cramer's rule for the first unknown: replace column 1 by the right-hand side \( (0, \sec t)^{\mathsf{T}} \) and divide by \( W = 1 \). B
3
\[ u_2' = \frac{1}{W} \det \begin{pmatrix} \cos t & 0 \\ -\sin t & \sec t \end{pmatrix} = \cos t \sec t - 0 = 1. \]
Cramer's rule for the second unknown: replace column 2 by the right-hand side. A
4
\[ u_1 = \int -\tan t \, dt = \ln(\cos t), \qquad u_2 = \int 1 \, dt = t \qquad \left( t \in \left(-\tfrac{\pi}{2}, \tfrac{\pi}{2}\right) \right). \]
Antidifferentiation; \( \cos t \gt 0 \) on the interval, so no absolute value is needed, and additive constants may be taken zero since any particular solution suffices. A
\[ y_p(t) = \cos t \, \ln(\cos t) + t \sin t \]

Reading. Because the system's coefficients are functions of \( t \), Gaussian elimination would have to be redone symbolically; Cramer's rule gives \( u_1', u_2' \) in closed form in one line each. This is the standard derivation of the variation-of-parameters formula \( u_1' = -y_2 g / W \), \( u_2' = y_1 g / W \) in ODE theory.

Problems
  1. Use Cramer's rule to solve \( \begin{aligned} 3x + 4y &= 7 \\ 5x - 2y &= 3 \end{aligned} \) over \( \mathbb{R} \), verifying first that the rule applies.
    Solution

    \( \det A = \det \begin{pmatrix} 3 & 4 \\ 5 & -2 \end{pmatrix} = 3(-2) - 4 \cdot 5 = -26 \neq 0 \), so the rule applies and the solution is unique. Then \[ x = \frac{ \det \begin{pmatrix} 7 & 4 \\ 3 & -2 \end{pmatrix} }{-26} = \frac{-14 - 12}{-26} = 1, \qquad y = \frac{ \det \begin{pmatrix} 3 & 7 \\ 5 & 3 \end{pmatrix} }{-26} = \frac{9 - 35}{-26} = 1. \] Check: \( 3 + 4 = 7 \) and \( 5 - 2 = 3 \). Solution \( (x, y) = (1, 1) \).

  2. For which \( k \in \mathbb{R} \) does the system \( \begin{aligned} kx + y &= 1 \\ x + ky &= 1 \end{aligned} \) have a unique solution? Find it via Cramer's rule, and describe completely what happens for the exceptional values of \( k \).
    Solution

    \( \det A = k^2 - 1 \), so the solution is unique exactly when \( k \neq \pm 1 \) (uniqueness for square systems is equivalent to \( \det A \neq 0 \), by the theorem and its converse). For \( k \neq \pm 1 \): \[ x = \frac{ \det \begin{pmatrix} 1 & 1 \\ 1 & k \end{pmatrix} }{k^2 - 1} = \frac{k - 1}{(k-1)(k+1)} = \frac{1}{k+1}, \qquad y = \frac{ \det \begin{pmatrix} k & 1 \\ 1 & 1 \end{pmatrix} }{k^2 - 1} = \frac{k - 1}{k^2 - 1} = \frac{1}{k+1}. \] So \( (x, y) = \left( \frac{1}{k+1}, \frac{1}{k+1} \right) \). Exceptional values: for \( k = 1 \) both equations read \( x + y = 1 \), giving the infinite solution family \( (t, 1 - t) \); for \( k = -1 \) the equations read \( -x + y = 1 \) and \( x - y = 1 \), whose sum is \( 0 = 2 \) — inconsistent, no solutions.

  3. Let \( A \in \mathbb{Z}^{n \times n} \) with \( \det A = \pm 1 \) (a unimodular matrix). Prove that for every \( b \in \mathbb{Z}^n \) the system \( Ax = b \) has a unique solution with all coordinates in \( \mathbb{Z} \). Prove the converse: if \( Ax = b \) is solvable in \( \mathbb{Z}^n \) for every \( b \in \mathbb{Z}^n \), then \( \det A = \pm 1 \).
    Solution

    Forward direction. Since \( \det A = \pm 1 \neq 0 \), Cramer's rule (over the field \( \mathbb{Q} \supseteq \mathbb{Z} \)) gives a unique solution with \[ x_i = \frac{\det A_i(b)}{\det A} = \pm \det A_i(b). \] Each \( A_i(b) \) has integer entries, and the determinant of an integer matrix is an integer (it is a polynomial in the entries with integer coefficients, by the Leibniz formula). Hence every \( x_i \in \mathbb{Z} \).

    Converse. Suppose \( Ax = b \) is solvable in \( \mathbb{Z}^n \) for every integer \( b \). First, \( \det A \neq 0 \): otherwise the columns of \( A \) span a proper subspace of \( \mathbb{Q}^n \), and any integer vector outside it (such a vector exists since the subspace is a proper subset closed under scaling, while \( \mathbb{Z}^n \) spans \( \mathbb{Q}^n \)) would be unreachable. Now take \( b = e_j \) for \( j = 1, \dots, n \); the integer solutions assemble into an integer matrix \( B \) with \( AB = I_n \). Taking determinants, \( \det A \cdot \det B = 1 \) with both factors integers, so \( \det A \in \{ 1, -1 \} \).

  4. Deduce the adjugate inverse formula from Cramer's rule: for invertible \( A \in F^{n \times n} \), show \( (A^{-1})_{ij} = \dfrac{C_{ji}}{\det A} \), where \( C_{ji} = (-1)^{j+i} M_{ji} \) and \( M_{ji} \) is the minor obtained by deleting row \( j \) and column \( i \) of \( A \). Conclude \( A^{-1} = (\det A)^{-1} \operatorname{adj} A \).
    Solution

    The \( j \)-th column \( c_j \) of \( A^{-1} \) satisfies \( A c_j = e_j \) (read off column \( j \) of \( A A^{-1} = I_n \)). Since \( \det A \neq 0 \), Cramer's rule applies to this system: \[ (A^{-1})_{ij} = (c_j)_i = \frac{\det A_i(e_j)}{\det A}. \] Now compute \( \det A_i(e_j) \) by cofactor expansion along its \( i \)-th column, which is \( e_j \): the only nonzero entry in that column is the \( 1 \) in row \( j \), so \[ \det A_i(e_j) = (-1)^{j+i} \cdot 1 \cdot M_{ji} = C_{ji}, \] where the minor \( M_{ji} \) is the determinant of \( A \) with row \( j \) and column \( i \) deleted — deleting row \( j \) and column \( i \) of \( A_i(e_j) \) removes exactly the inserted column and leaves the corresponding submatrix of \( A \). Hence \( (A^{-1})_{ij} = C_{ji} / \det A \). Since \( \operatorname{adj} A \) is by definition the transpose of the cofactor matrix, \( (\operatorname{adj} A)_{ij} = C_{ji} \), and therefore \( A^{-1} = (\det A)^{-1} \operatorname{adj} A \). Note the index transposition: this is precisely the "cofactor transpose slip" flagged under Common errors.

  5. (Ring version.) Let \( R \) be a commutative ring with \( 1 \), \( A \in R^{n \times n} \), \( b \in R^n \). (a) Prove that every solution \( x \in R^n \) of \( Ax = b \) satisfies \( (\det A) \, x_i = \det A_i(b) \) for all \( i \), with no invertibility assumption. (b) Prove that if \( \det A \) is a unit of \( R \), then \( Ax = b \) has exactly one solution, given by \( x_i = (\det A)^{-1} \det A_i(b) \). (c) Give an example showing that \( \det A \neq 0 \) alone does not suffice for uniqueness over a ring.
    Solution

    (a) Define \( \det \) over \( R \) by the Leibniz formula \( \det M = \sum_{\sigma \in S_n} \operatorname{sgn}(\sigma) \prod_{k=1}^n m_{\sigma(k), k} \). Multilinearity in each column and the alternating property (equal columns force determinant \( 0 \), by pairing \( \sigma \) with \( \sigma \circ (i\;j) \) — valid in any commutative ring, including those of characteristic \( 2 \)) are then direct consequences. Let \( x \) be any solution. Steps 3–6 of the main proof use only these two properties and never divide: \( b = \sum_j x_j a_j \), so \[ \det A_i(b) = \sum_{j=1}^n x_j \det A_i(a_j) = x_i \det A, \] since \( \det A_i(a_j) = 0 \) for \( j \neq i \) (repeated column) and \( A_i(a_i) = A \). This proves (a).

    (b) If \( u := \det A \in R^\times \), then \( B := u^{-1} \operatorname{adj} A \) satisfies \( BA = AB = I_n \) by the adjugate identity \( (\operatorname{adj} A) A = A (\operatorname{adj} A) = (\det A) I_n \), which holds over every commutative ring (it is the collection of cofactor-expansion identities, again polynomial identities in the entries). Hence \( x = B b \) is a solution, and any solution \( y \) satisfies \( y = B(Ay) = Bb \), so it is unique. By part (a) applied to this solution, \( u \, x_i = \det A_i(b) \), and multiplying by \( u^{-1} \) gives the stated formula.

    (c) Over \( R = \mathbb{Z}/6\mathbb{Z} \), take the \( 1 \times 1 \) system \( 2x = 2 \). Then \( \det A = 2 \neq 0 \) in \( R \), but \( x = 1 \) and \( x = 4 \) are distinct solutions ( \( 2 \cdot 4 = 8 = 2 \) ). Consistently with (a), \( (\det A)x_1 = 2x = 2 = \det A_1(b) \) holds for both; the identity survives, but division — hence uniqueness — fails because \( 2 \) is a zero divisor, not a unit. (Similarly, over \( \mathbb{Z} \) the system \( 2x = 1 \) has \( \det A = 2 \neq 0 \) and no solution at all: existence also needs the unit condition.)