Cramer's Rule & Invertible Matrices
3614 words
18 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Cramer's Rule & Invertible Matrices ## ๐ฏ Learning Objectives After this topic you will be able to: - State and apply Cramer's rule to solve $A\mathbf{x} = \mathbf{b}$ when $A$ is square and invertible - Compute the adjugate (classical adjoint) of a matrix - Find the inverse of a matrix using the adjugate formula...

Cramer's Rule & Invertible Matrices
๐ฏ Learning Objectives
After this topic you will be able to:
- State and apply Cramer's rule to solve Ax=b when A is square and invertible
- Compute the adjugate (classical adjoint) of a matrix
- Find the inverse of a matrix using the adjugate formula Aโ1=det(A)adj(A)โ
- Determine when Cramer's rule is (and isn't) computationally practical
- Express solutions to linear systems using determinants
๐ Prerequisites
- Determinants (Week 1) โ computing det, minors, cofactors
- Gaussian Elimination (this week) โ the standard method for solving systems
- Matrix Multiplication (Week 1) โ Aโ1 is defined by AAโ1=I
- Cramer's rule provides an elegant theoretical formula, though Gaussian elimination is usually more practical
1. Intuition: What Cramer's Rule Does
Cramer's rule expresses the solution of Ax=b directly in terms of determinants. For each variable xjโ:
- Take the coefficient matrix A
- Replace column j of A with b
- Compute the determinant of this new matrix
- Divide by det(A) The result is xjโ. It's a beautiful formula, but computationally expensive for large n (requires n+1 determinants).
2. Cramer's Rule
2.1 Statement
>xjโ=det(A)det(Ajโ)โ,j=1,2,โฆ,n>Theorem (Cramer's Rule). Let A be an nรn invertible matrix (so det(A)๎ =0). For any bโRn, the unique solution to Ax=b is:
>x1โa1โ+x2โa2โ+โฏ+xnโanโ=b>where Ajโ is the matrix formed by replacing the j-th column of A with b. Proof SketchLet A=[a1โa2โโฆanโ] where ajโ is column j. Then Ax=b means:
>det(Ajโ)=det[a1โโฆk=1โnโxkโakโโฆanโ]=xjโdet(A)>Consider Ajโ=[a1โโฆbโฆanโ] (column j replaced by b). Using multilinearity of the determinant:
because all terms with k๎ =j have two identical columns (determinant zero). Hence xjโ=det(Ajโ)/det(A).
2.2 2ร2 Case
For
,
:
>{2x+3y=74xโy=1โ>Example 1: 2ร2 Cramer's ruleSolve:
>A1โ=[71โ3โ1โ]>det(A)=2(โ1)โ3(4)=โ2โ12=โ14
>A2โ=[24โ71โ]>, det(A1โ)=7(โ1)โ3(1)=โ7โ3=โ10
, det(A2โ)=2(1)โ7(4)=2โ28=โ26x=โ14โ10โ=75โ, y=โ14โ26โ=713โCheck: 2(75โ)+3(713โ)=710+39โ=7 โ
2.3 3ร3 Case
>โฉโจโงโx+2y+z=32xโy+3z=23x+yโz=6โ>Example 2: 3ร3 Cramer's ruleSolve:
>A=โ123โ2โ11โ13โ1โโ>
>det(A)โ=1(โ1)(โ1)+2(3)(3)+1(2)(1)โ1(โ1)(3)โ1(3)(1)โ2(2)(โ1)=1+18+2โ(โ3)โ3โ(โ4)=1+18+2+3โ3+4=25โ>Step 1: Compute det(A):
>A1โ=โ326โ2โ11โ13โ1โโ>Step 2: Compute A1โ (replace column 1 with b):
>det(A1โ)โ=3(โ1)(โ1)+2(3)(6)+1(2)(1)โ1(โ1)(6)โ3(3)(1)โ2(2)(โ1)=3+36+2+6โ9+4=42โ>
>A2โ=โ123โ326โ13โ1โโ>x=2542โStep 3: A2โ (replace column 2):
>det(A2โ)=1(2)(โ1)+3(3)(3)+1(2)(6)โ1(2)(3)โ1(3)(6)โ3(2)(โ1)=โ2+27+12โ6โ18+6=19>
>A3โ=โ123โ2โ11โ326โโ>y=2519โStep 4: A3โ (replace column 3):
>det(A3โ)=1(โ1)(6)+2(2)(3)+3(2)(1)โ3(โ1)(3)โ1(2)(1)โ2(2)(6)=โ6+12+6+9โ2โ24=โ5>
z=25โ5โ=โ51โSolution: x=2542โ, y=2519โ, z=โ51โ.
3. Cramer's Rule vs. Gaussian Elimination
| Aspect | Cramer's Rule | Gaussian Elimination |
|---|---|---|
| Computational cost | O(n!) (requires n+1 determinants) | O(n3) |
| Practical for | nโค3 (textbook/exam problems) | nโฅ3 (real-world) |
| Works for singular A ? | No (requires det(A)๎ =0 ) | Yes (detects inconsistency) |
| Conceptual value | Explicit formula; great for theory | Algorithmic; great for computation |
Why Cramer's rule matters despite being expensive: It proves that the solution depends continuously on the entries of A and b (since determinants are continuous functions). This is useful in theoretical arguments.
4. The Adjugate and Matrix Inverse
4.1 Cofactor Matrix and Adjugate
>adj(A)=CT>Definition (Cofactor Matrix). The cofactor matrix C of A has entries Cijโ=(โ1)i+jMijโ (the cofactors). Definition (Adjugate). The adjugate (or classical adjoint) of A is the transpose of the cofactor matrix:
4.2 Inverse via Adjugate
>Aโ1=det(A)1โadj(A)>Theorem. If det(A)๎ =0, then:
This formula is theoretically important but computationally inefficient for large n (Gaussian elimination is better).
>A=[acโbdโ]>Example 3: Inverse of a 2ร2 matrix using adjugate
>C=[dโbโโcaโ]>Cofactor matrix:
>adj(A)=CT=[dโcโโbaโ]>Adjugate:
>Aโ1=adโbc1โ[dโcโโbaโ]>
>AAโ1=adโbc1โ[acโbdโ][dโcโโbaโ]=adโbc1โ[adโbc0โ0adโbcโ]=I>Check:
>A=โ105โ216โ340โโ>โ Example 4: Inverse of a 3ร3 matrix
>det(A)=1(1โ 0โ4โ 6)โ2(0โ 0โ4โ 5)+3(0โ 6โ1โ 5)=1(โ24)โ2(โ20)+3(โ5)=โ24+40โ15=1>Step 1: Compute det(A).
>C11โ=+det[16โ40โ]=0โ24=โ24>Step 2: Compute all 9 cofactors.
>C12โ=โdet[05โ40โ]=โ(0โ20)=20>
>C13โ=+det[05โ16โ]=0โ5=โ5>
>C21โ=โdet[26โ30โ]=โ(0โ18)=18>
>C22โ=+det[15โ30โ]=0โ15=โ15>
>C23โ=โdet[15โ26โ]=โ(6โ10)=4>
>C31โ=+det[21โ34โ]=8โ3=5>
>C32โ=โdet[10โ34โ]=โ(4โ0)=โ4>
>C33โ=+det[10โ21โ]=1โ0=1>
>adj(A)=โโ2420โ5โ18โ154โ5โ41โโ>Step 3: Form the adjugate (transpose of cofactor matrix):
>Aโ1=11โadj(A)=โโ2420โ5โ18โ154โ5โ41โโ>Step 4: Since det(A)=1:
Verify: AAโ1=I (check one entry: first row of A times first column of Aโ1: 1(โ24)+2(20)+3(โ5)=โ24+40โ15=1 โ).
4.3 Properties of the Adjugate
| Property | Formula |
|---|---|
| Product | adj(AB)=adj(B)adj(A) |
| Transpose | adj(AT)=(adj(A))T |
| Inverse | adj(Aโ1)=(adj(A))โ1 |
| Determinant | det(adj(A))=(det(A))nโ1 |
| Scalar | adj(cA)=cnโ1adj(A) |
| Fundamental identity | Aโ adj(A)=adj(A)โ A=det(A)โ Inโ |
5. Edge Cases & Gotchas
| Situation | What Happens |
|---|---|
| ** det(A)=0 ** | Cramer's rule is undefined; the system may have 0 or infinitely many solutions |
| Rectangular matrices | Cramer's rule only works for square A |
| ** 1ร1 system** | A=[a] , x=b/a (Cramer's rule reduces to division) |
| Near-zero determinant | Numerically unstable โ small errors in det blow up the solution |
6. Common Pitfalls
โ Pitfall 1: Forgetting to divide by det(A)
The formula is xjโ=det(Ajโ)/det(A), not xjโ=det(Ajโ). The determinant of the modified matrix alone is not the solution.
โ Pitfall 2: Misplacing b in the wrong column
To find x2โ, replace column 2 of A with b โ not column 1 or 3.
โ Pitfall 3: Applying Cramer's rule to non-square or singular systems
The rule requires A to be square with det(A)๎ =0. Check this first before computing anything.
โ Pitfall 4: Confusing adjugate and inverse
Aโ1=adj(A)/det(A), not adj(A) alone (unless det(A)=1).
7. Formula Summary Table
| Concept | Formula |
|---|---|
| Cramer's rule | xjโ=det(A)det(Ajโ)โ , Ajโ = A with column j replaced by b |
| Cofactor | Cijโ=(โ1)i+jMijโ |
| Adjugate | adj(A)=CT |
| Inverse via adjugate | Aโ1=det(A)1โadj(A) |
| 2ร2 inverse (memorise) | [acโbdโ]โ1=adโbc1โ[dโcโโbaโ] |
| Fundamental identity | Aโ adj(A)=det(A)โ I |
8. ๐ Practice Questions
>{3x+2y=7xโ5y=โ2โ>Q1: 2ร2 Cramer's ruleSolve:
>det(A1โ)=โ7โ2โ2โ5โโ=7(โ5)โ2(โ2)=โ35+4=โ31>Strategy: Compute det(A), det(A1โ), det(A2โ), then x and y.Solution: det(A)=3(โ5)โ2(1)=โ15โ2=โ17
>det(A2โ)=โ31โ7โ2โโ=3(โ2)โ7(1)=โ6โ7=โ13>
>โฉโจโงโx+y+z=62xโy+z=3x+2yโz=2โ>x=โ17โ31โ=1731โ, y=โ17โ13โ=1713โ. Q2: 3ร3 Cramer's ruleSolve:
>det(A)=โ121โ1โ12โ11โ1โโ>Solution:
>A1โ=โ632โ1โ12โ11โ1โโ>=1(โ1)(โ1)+1(1)(1)+1(2)(2)โ1(โ1)(1)โ1(1)(2)โ1(2)(โ1) =1+1+4+1โ2+2=7
>A2โ=โ121โ632โ11โ1โโ>, det(A1โ)=6(โ1)(โ1)+1(1)(2)+1(3)(2)โ1(โ1)(2)โ6(1)(2)โ1(3)(โ1) =6+2+6+2โ12+3=7x=77โ=1
>A3โ=โ121โ1โ12โ632โโ>, det(A2โ)=1(3)(โ1)+6(1)(1)+1(2)(2)โ1(3)(1)โ1(1)(2)โ6(2)(โ1) =โ3+6+4โ3โ2+12=14y=714โ=2
>A=[42โ31โ]>, det(A3โ)=1(โ1)(2)+1(3)(1)+6(2)(2)โ6(โ1)(1)โ1(3)(2)โ1(2)(2) =โ2+3+24+6โ6โ4=21z=721โ=3Solution: x=1, y=2, z=3. Q3: 2ร2 inverseFind Aโ1 for
>Aโ1=โ21โ[1โ2โโ34โ]=[โ21โ1โ23โโ2โ]>.Solution: det(A)=4(1)โ3(2)=4โ6=โ2
>AAโ1=[42โ31โ][โ21โ1โ23โโ2โ]=[โ2+3โ1+1โ6โ63โ2โ]=[10โ01โ]>Verify:
>A=โ124โ0โ11โ238โโ>โ Q4: 3ร3 inverseFind Aโ1 for
>C11โ=+det[โ11โ38โ]=โ8โ3=โ11>.Solution: det(A)=1(โ1)(8)+0(3)(4)+2(2)(1)โ2(โ1)(4)โ1(3)(1)โ0(2)(8) =โ8+0+4+8โ3โ0=1Cofactors:
>C12โ=โdet[24โ38โ]=โ(16โ12)=โ4>
>C13โ=+det[24โโ11โ]=2โ(โ4)=6>
>C21โ=โdet[01โ28โ]=โ(0โ2)=2>
>C22โ=+det[14โ28โ]=8โ8=0>
>C23โ=โdet[14โ01โ]=โ(1โ0)=โ1>
>C31โ=+det[0โ1โ23โ]=0โ(โ2)=2>
>C32โ=โdet[12โ23โ]=โ(3โ4)=1>
>C33โ=+det[12โ0โ1โ]=โ1โ0=โ1>
>adj(A)=CT=โโ11โ46โ20โ1โ21โ1โโ>
>{kx+y=1x+ky=1โ>Since det(A)=1, Aโ1=adj(A). Q5: Using Cramer's rule with parametersFor what k does Cramer's rule apply? Solve for x and y:
>det(A1โ)=โ11โ1kโโ=kโ1>Solution: det(A)=k(k)โ1(1)=k2โ1=(kโ1)(k+1)Cramer's rule applies when det(A)๎ =0, i.e., k๎ =ยฑ1.
>det(A2โ)=โk1โ11โโ=kโ1>
>A=[23โ14โ]>x=(kโ1)(k+1)kโ1โ=k+11โ (for k๎ =ยฑ1) y=(kโ1)(k+1)kโ1โ=k+11โ (for k๎ =ยฑ1)Check: When k=1, the system is x+y=1, x+y=1 (infinitely many solutions). When k=โ1, the system is โx+y=1, xโy=1 (inconsistent). Q6: Adjugate propertiesVerify Aโ adj(A)=det(A)โ I for
>adj(A)=[4โ3โโ12โ]>.Solution: det(A)=8โ3=5
>Aโ adj(A)=[23โ14โ][4โ3โโ12โ]=[8โ312โ12โโ2+2โ3+8โ]=[50โ05โ]=5I>
>A=[12โ25โ]>โ Q7: Solving with inverseSolve Ax=b using Aโ1 where
>b=[37โ]>,
>Aโ1=11โ[5โ2โโ21โ]=[5โ2โโ21โ]>.Solution: det(A)=5โ4=1
>x=Aโ1b=[5โ2โโ21โ][37โ]=[15โ14โ6+7โ]=[11โ]>
>{5x+3y=1902x+4y=120โ>Check: 1(1)+2(1)=3 โ, 2(1)+5(1)=7 โ. Q8: Cramer's rule โ word problemA company makes two products. The profit equations are:
>det(A1โ)=โ190120โ34โโ=190(4)โ3(120)=760โ360=400>where x = units of product A, y = units of product B. Find x and y.Solution: det(A)=5(4)โ3(2)=20โ6=14
>det(A2โ)=โ52โ190120โโ=5(120)โ190(2)=600โ380=220>
>{x+2y=52x+4y=10โ>x=14400โโ28.57, y=14220โโ15.71. Q9: Determinant of adjugateIf A is 3ร3 with det(A)=โ4, find det(adj(A)).Solution: det(adj(A))=(det(A))nโ1=(โ4)2=16. Q10: When Cramer's rule failsExplain why Cramer's rule cannot solve the system:
>[xyโ]=[50โ]+y[โ21โ]>and find all solutions.Solution: det(A)=1(4)โ2(2)=4โ4=0, so Cramer's rule is inapplicable.The second equation is twice the first, so we have x+2y=5. x=5โ2y, y free. Infinitely many solutions.Parametric:
.
๐ Cross-References
- Next topic: Vector Spaces Definition
- Week 1 (Determinants): Foundation for Cramer's rule
- Week 5 (Rank-Nullity): det(A)๎ =0 means full rank, zero nullity
- Week 12 (Eigenvalues): The characteristic polynomial uses det(AโฮปI)
- BSCS3004 (Deep Learning): Matrix inverses appear in normal equations for linear regression Join Discord Previous2.1 Gaussian EliminationNext3.1 Vector Spaces Definition