Mathematics for Finance
Matrix inverse
Many finance problems are several equations that must all hold at once. Write them as one matrix equation, and the inverse matrix solves them all in a single step.
Copy a payoff with bonds you can buy
Example, with made-up numbers. You want $50 in one year and $210 in two years. Bond A pays $5, then $105. Bond B pays $100 in one year and nothing after. How many of each should you buy so the cash flows match exactly?
The idea
Each year gives one equation. Year 1: 5a + 100b = 50. Year 2: 105a + 0b = 210. Stack the cash flows into a matrix M, the holdings into a vector x and the targets into t:
Rows are years, columns are bonds. Multiplying both sides by M−1 leaves the holdings on their own.
There's no dividing by a matrix. Instead, the inverse M−1 undoes M, the way multiplying by ½ undoes doubling. For a 2 × 2 matrix there's a short recipe:
Swap the diagonal, flip the signs of the other two, divide by the determinant. If the determinant is 0, there's no inverse: the equations don't have one clear answer.
Quick check
What's the determinant of [2, 3; 4, 6], and what does it tell you?
Worked example: the replicating bonds
| 1. Determinant of [5, 100; 105, 0] | 5 × 0 − 100 × 105 = −10,500 |
| 2. Inverse | (1 ÷ −10,500) × [0, −100; −105, 5] |
| 3. Bonds A: first row × targets | (0 × 50 − 100 × 210) ÷ −10,500 = 2 |
| 4. Bonds B: second row × targets | (−105 × 50 + 5 × 210) ÷ −10,500 = 0.4 |
Check: year 1, 2 × 5 + 0.4 × 100 = 50. Year 2, 2 × 105 = 210. If A costs $98 and B $95, the target payoff must be worth 2 × 98 + 0.4 × 95 = $234. Any other price would let someone profit risk-free. In Excel: =MINVERSE, =MMULT and =MDETERM do the same for matrices of any size.
Where you'll see it
Pricing by replication, like the bonds above, works this way for bonds and options. Linear regression with several inputs solves its equations with an inverse. And the lowest-risk portfolio of many assets uses the inverse of the covariance matrix from the last lesson. When the determinant is close to zero, say two funds that move almost identically, the answers swing wildly with tiny changes. That's a warning sign.
Try it yourself
Solve any two equations with the inverse.
Equation 1: a1 × x + b1 × y = t1
Equation 2: a2 × x + b2 × y = t2
| Determinant | |
| Inverse | |
| Solution |
Common mistakes
Three slips beginners make.
- Trying to divide by a matrix. Multiply by the inverse instead, and on the correct side: x = M−1t, not tM−1.
- Ignoring a tiny determinant. Near zero, the inverse has huge numbers and small data errors become big answer errors.
- Mixing up rows and columns. Keep one meaning for each: here, rows are years and columns are bonds.
Remember
- Write many equations as Mx = t, then solve with x = M−1t.
- 2 × 2 inverse: swap the diagonal, flip the other signs, divide by the determinant ad − bc.
- Determinant 0 means no unique answer. Near 0 means fragile answers. In Excel, =MINVERSE and =MDETERM.
Check yourself
Three questions. Try them without scrolling up.
1. What's the determinant of [3, 1; 2, 4]?
2. What's the inverse of [2, 0; 0, 4]?
3. You try to replicate a payoff with two bonds and the determinant is 0. Why?
Section practice · optional
Advanced tools
9 mixed problems from lessons 22 to 26 · about 15 minutes
The problems aren't labeled with a lesson, so part of the work is choosing the right tool. Work each one on paper, then open the answer.
For f = x²y³, find ∂f/∂x at x = 1, y = 2.
Show answer
Partial derivativesTreat y as a constant: 2xy³ = 2 × 1 × 8 = 16.An option has delta 0.4 and vega 0.2 (per volatility point). The share rises $1 and volatility rises 2 points. Estimate the option's change.
Show answer
Partial derivativesAdd the effects: 0.4 × 1 + 0.2 × 2 = +$0.80.Maximize x × y when 2x + y = 20.
Show answer
Optimization with a limitSubstitute y = 20 − 2x: f = 20x − 2x². Derivative 20 − 4x = 0, so x = 5, y = 10, best value 50.Two funds each have a 10% standard deviation and a correlation of 0.5. What's the lowest-risk split, and its risk?
Show answer
Optimization with a limitIdentical funds: 50/50. Risk 10% × √((1 + 0.5) ÷ 2) = 8.66%.Estimate √102 from √100 = 10 using the slope only.
Show answer
Taylor approximationsSlope of √x is 1 ÷ (2√x) = 0.05. 10 + 0.05 × 2 = 10.1. Exact: 10.0995.A bond has duration 5 and convexity 40. Yields fall 1 point. Estimate the price change.
Show answer
Taylor approximations−5 × (−0.01) + ½ × 40 × 0.01² = 0.05 + 0.002 = +5.2%.Weights (0.5, 0.5), expected returns (6%, 10%). What's the expected portfolio return?
Show answer
Vectors and matricesDot product: 0.5 × 6 + 0.5 × 10 = 8%.Standard deviations 20% and 10%, correlation 0, weights 50/50. What's the portfolio risk?
Show answer
Vectors and matricesCovariance matrix [0.04, 0; 0, 0.01]. Variance 0.25 × 0.04 + 0.25 × 0.01 = 0.0125. Risk 11.2%.Solve 2x + y = 7 and x + 3y = 11 with the inverse.
Show answer
Matrix inverseDeterminant 2 × 3 − 1 × 1 = 5. Inverse (1/5) × [3, −1; −1, 2]. x = (3 × 7 − 11) ÷ 5 = 2, y = (−7 + 2 × 11) ÷ 5 = 3.
More Mathematics on the way
This completes the Mathematics path for now. Try the section practice above.