Day 19. Inverses, Determinants & Systems of Equations
Solving Ax = b, what the determinant measures, and why nearly singular systems are fragile.
- ●Compute 2×2 and 3×3 determinants and the inverse of a 2×2 matrix.
- ●Prove the main inverse rules and connect a zero determinant to rank deficiency.
- ●Solve market-equilibrium and input–output models as linear systems and do comparative statics.
- ●Explain ill-conditioning and why it makes estimates sensitive to small data changes.
Theory
Linear systems
A system of equations in unknowns is . If has an inverse (with ), the unique solution is .
The 2×2 case
Determinants
For 3×3 matrices, expand along the first row (cofactor expansion):
Key facts:
- is the factor by which scales areas (volumes); the sign says whether it flips orientation.
- , , .
- is invertible full rank only for .
Inverse rules
In practice, software never forms to solve a system; it uses elimination (LU or QR factorisations), which is faster and more accurate.
Conditioning
If is close to zero relative to the size of the entries, is ill-conditioned: tiny changes in or produce large changes in . The condition number (ratio of largest to smallest singular value) measures this; Day 21 relates it to eigenvalues of .
Part 1 · Warm-up
Exercise 1 · A determinant
Compute .
Show solution
.
Exercise 2 · An inverse
Find the inverse of the matrix in Exercise 1 and check it.
Show solution
. Check: .
Exercise 3 · Solving a system
Solve , .
Show solution
Step 1. Write the system as with (Exercise 2).
Step 2. .
Step 3. .
Step 4. Check: and . ✓
Answer: .
Exercise 4 · A 3×3 determinant
Compute . Is the matrix invertible?
Show solution
. Singular: not invertible. (Column 3 = ½ column 1 + ½ column 2.)
Exercise 5 · Area scaling
maps the unit square to a parallelogram. What is its area?
Show solution
. The images of and are and : base 2, height 3.
Part 2 · Proofs
Exercise 6 · Inverse of a product
Prove for invertible and .
Show solution
, and similarly in the other order. Inverses are unique, so this is .
Exercise 7 · Inverse of a transpose
Prove . Conclude that the inverse of a symmetric matrix is symmetric.
Show solution
Step 1. .
Step 2. If , then .
Step 3. So is symmetric, as a covariance matrix must be.
Exercise 8 · The 2×2 formula
Verify that the 2×2 inverse formula satisfies .
Show solution
. Dividing by gives ; this is possible only if .
Exercise 9 · Determinant of the inverse
Using , prove .
Show solution
. So and .
Exercise 10 · Unique, none, or infinitely many
Show that if is invertible, has exactly one solution. Give a singular example with no solution and one with infinitely many.
Show solution
Step 1 (existence). works: .
Step 2 (uniqueness). If , then ; multiply by to get .
Step 3 (singular, no solution). , : the equations and are parallel lines.
Step 4 (singular, infinitely many). Same with : both equations are the line .
Part 3 · Applied
Exercise 11 · Market equilibrium
Demand and supply , with income . Write the system as and solve it.
Show solution
Step 1. Substitute : demand is , i.e. . Supply is .
Step 2. Matrix form:
Step 3. Inverse: .
Step 4. and .
Answer: equilibrium price 20 and quantity 80.
Exercise 12 · Comparative statics
In Exercise 11, find and .
Show solution
Step 1. Income enters only the right-hand side: , so .
Step 2. , hence .
Step 3. Using from Exercise 11: .
Answer: and : a $1 rise in income raises quantity by 0.3 and price by 0.1.
Exercise 13 · An ill-conditioned diet plan
A school-meals programme mixes two foods, and (kg per pupil per week), whose nutrient contents are almost identical. It must hit a calorie target and a protein target:
Solve the system. Then suppose the protein target is revised to 2.002 and solve again.
Show solution
Step 1. Subtract the first equation from the second: , so .
Step 2. With the revised target: , so .
Step 3. Why: ; the two lines are almost parallel (condition number ≈ 4,000).
Answer: a 0.05% change in one target switches the plan from 1 kg of each food to 2 kg of one and none of the other. Collinear regressors make fragile in exactly this way.
Exercise 14 · Leontief input–output
Two sectors use each other's output: , final demand . Gross output solves . Find .
Show solution
Step 1. .
Step 2. , with determinant .
Step 3. .
Step 4. and .
Answer: gross output (175, 133.3): delivering 100 and 50 to final users requires extra production for intermediate use.
Exercise 15 · The IV estimator solves a system
With one instrument and one regressor (both centred), the IV condition is . Solve for , and evaluate it when and .
Show solution
Step 1. Expand the condition: .
Step 2. Solve: . Dividing numerator and denominator by turns these into sample covariances.
Step 3. .
Answer: 2, the Wald ratio from Day 12. With several instruments and regressors, , and a weak first stage ( near singular) is an ill-conditioned system like Exercise 13.
Verify in Python
import numpy as np
A = np.array([[3, 1], [2, 4.]])
print("det =", round(np.linalg.det(A), 6), "\ninverse =\n", np.linalg.inv(A))
print("solution:", np.linalg.solve(A, [9, 16]))
print("3x3 det:", round(np.linalg.det(np.array([[2, 0, 1], [1, 3, 2], [1, 1, 1.]])), 10))
M = np.array([[1, 2], [1, -3.]])
print("equilibrium (Q, P):", np.linalg.solve(M, [120, 20]), " d/dY:", np.linalg.solve(M, [0.5, 0]))
B = np.array([[1, 1], [1, 1.001]])
print("ill-conditioned:", np.linalg.solve(B, [2, 2.001]), np.linalg.solve(B, [2, 2.002]),
" condition number:", round(np.linalg.cond(B)))
L = np.array([[0.2, 0.3], [0.4, 0.1]])
print("Leontief output:", np.linalg.solve(np.eye(2) - L, [100, 50]).round(2))
Key takeaways
- has a unique solution iff , iff has full rank.
- is an area/volume scale factor; a determinant near zero means a nearly flat (fragile) map.
- Equilibrium models, input–output models and IV estimators are all linear systems.
Simulation Lab: Solving Ax = b
Open full screen →Two equations as two lines: as the determinant shrinks, the solution becomes fragile and then disappears.
Each equation is a line; the solution is where they cross. As c → 1 the lines become parallel, det A → 0 and the crossing point races off: a tiny change in b moves the solution a lot. That is ill-conditioning.