Mathematics for Finance
Optimization with a limit
Real choices come with a limit: a budget, a weight that must add to 100%. The best point is where moving the last dollar from one use to another no longer helps.
Can a riskier fund lower your risk?
Example, with made-up numbers. Fund B has a standard deviation of 10%. Fund A swings twice as much, 20%. Their correlation is 0.2. Every dollar must go into one or the other. To get the lowest possible risk, is it best to put everything into the calmer fund B?
The idea
Without a limit, you'd minimize risk by investing nothing. The limit here is that the weights add to 100%. There are two ways to handle a limit:
- Substitute. Use the limit to remove a variable. If w goes into A, then 1 − w goes into B. Now it's an ordinary one-variable problem: set the derivative to zero.
- Balance the margins. At the best split, the last dollar in A adds exactly as much risk as the last dollar in B. If not, you could move a dollar from the costlier side to the cheaper one and do better. This is the idea behind the Lagrange multiplier, which works with any number of variables.
Every point on the curve uses the whole budget. The lowest point is not at 0% in A.
Quick check
At the best split, the last dollar in A adds more risk than the last dollar in B. Is that possible?
Worked example: the lowest-risk split
| 1. Covariance = correlation × sdA × sdB | 0.2 × 0.20 × 0.10 = 0.004 |
| 2. Variance with w in A | 0.04w² + 0.01(1 − w)² + 2 × 0.004 × w(1 − w) |
| 3. Derivative, set to zero | 0.084w − 0.012 = 0 |
| 4. Solve | w = 0.012 ÷ 0.084 = 14.3% |
| 5. Risk at that split | √0.00914 = 9.56% |
Adding some of the riskier fund lowers total risk from 10% to 9.56%, because the two don't move together. Check the margins: the last dollar in A adds 0.08 × 0.143 + 0.008 × 0.857 = 0.0183 to variance, and the last dollar in B adds 0.02 × 0.857 + 0.008 × 0.143 = 0.0183. Equal, as they should be.
Where you'll see it
The same pattern runs through finance and economics. Portfolio theory finds the lowest risk for each target return. A firm splits a budget between projects until the last dollar earns the same in each. In economics, a shopper spends until the last dollar buys equal satisfaction everywhere. The Lagrange multiplier itself has a meaning: how much the best result would improve if the limit were loosened by one unit. That's why it's often called a shadow price.
Try it yourself
Find the lowest-risk split for any two funds.
| Best share in A | |
| Lowest risk | |
| Note |
Common mistakes
Three slips beginners make.
- Dropping the limit. Minimize risk with no budget rule and the answer is "invest nothing". The limit is what makes the problem real.
- Ignoring corners. If you can't go below 0% or above 100%, the best point may sit right at a limit, where the derivative isn't zero.
- Skipping the check. A zero derivative can be a top or a bottom. Check the second derivative or test nearby points.
Remember
- With a limit, either substitute it into the problem or balance the margins.
- At the best interior point, the last unit in each use gives the same benefit or cost.
- The Lagrange multiplier, or shadow price, is what loosening the limit by one unit is worth.
Check yourself
Three questions. Try them without scrolling up.
1. Maximize x × y when x + y = 10. What's the best value?
2. Two funds each have a 20% standard deviation and a correlation of 0. What's the lowest-risk split?
3. A Lagrange multiplier on a budget comes out at 0.3. What does it mean?
Taylor approximations
Slope plus bend: the idea behind duration and convexity, delta and gamma.