Matrix Inverses and Linear Systems
The matrix operation that 'undoes' a linear transformation — and the standard tool for solving systems of equations like hedge ratios or portfolio weights in one shot.
Prerequisites: Determinants, Linear Independence and Rank
A market maker needs to find hedge ratios for three correlated instruments so the combined position has zero net exposure to three separate risk factors. That's three equations in three unknowns — solvable by hand for small cases, but tedious and error-prone by substitution once the system grows. The matrix inverse turns this into one clean operation: write the system as a matrix equation, apply the inverse, and read off every unknown at once.
An analogy: undoing a mixing recipe
Imagine a machine that takes two input amounts and mixes them into two output amounts according to a fixed recipe — say, output 1 is always "2 times input A plus 1 times input B," and output 2 is "1 times input A plus 3 times input B." If you're handed the outputs and asked to figure out what inputs produced them, you need the "un-mixing" recipe — the exact reverse operation. The matrix inverse is that reverse recipe: applied to the machine's matrix, it undoes whatever the original matrix did, turning outputs back into the unique inputs that produced them (as long as the original recipe didn't destroy information by collapsing two different inputs onto the same output).
The mathematics, one symbol at a time
For a square matrix , its inverse is the unique matrix satisfying
where is the identity matrix (the "do nothing" transformation). In words: applying then , in either order, gets you back exactly where you started. The inverse exists if and only if (see Determinants), equivalently if 's columns are linearly independent. Given a linear system — a matrix of known coefficients, a vector of known targets, and an unknown vector to solve for — the solution is
read as: multiplying both sides of by cancels the on the left, leaving isolated and solved for directly, all unknowns at once. In practice, computers rarely form explicitly — they solve the system via decomposition methods like LU (see LU Decomposition) which are faster and more numerically stable — but the formula captures the idea cleanly.
Worked example 1: a 2×2 hedge ratio system by hand
Solve . First, the inverse of a matrix is . Here , so . Then . Check: ✓, and ✓.
Worked example 2: solving for hedge notionals
A trader wants a position long $0 exposure to two risk factors using two hedge instruments with sensitivities: instrument 1 has factor sensitivities per $1, instrument 2 has per $1, and the existing book has raw exposures that need to be exactly offset. Solve : determinant ; , . Buying about $4.70 of instrument 1 and $1.19 of instrument 2 exactly neutralizes both factor exposures at once.
Drag the transform above, note the transformed shape, then imagine reading it backward: the inverse matrix is exactly the transform that maps the distorted shape back to the original unit square — it exists as long as the shape hasn't been flattened onto a line.
What this means in practice
Solving via a matrix inverse (or, better, a stable decomposition) is the standard way to compute hedge ratios, factor-neutral portfolio weights, and the coefficients in ordinary least squares regression, where . When isn't square or isn't invertible — more equations than unknowns, or redundant instruments — the closely related pseudoinverse (see The Moore-Penrose Pseudoinverse) provides the best-fit generalization.
The inverse of a square matrix undoes what does, satisfying ; it exists exactly when , and it turns a linear system into a direct solution , solving for every unknown simultaneously instead of by substitution.
Never compute explicitly and then multiply by in real code — it's numerically wasteful and less stable than solving the system directly via a decomposition (LU, QR). Forming the full inverse matrix is a fine way to think about the operation, but production code should call a linear-solve routine, not construct as an intermediate object, especially for large or nearly singular systems where the difference in numerical accuracy can be substantial.
Related concepts
Practice in interviews
Further reading
- Strang, Introduction to Linear Algebra, ch. 2
- Golub & Van Loan, Matrix Computations, ch. 1