Variance of a sum
The risk of two positions together depends on how they move together. Standard deviations add like the sides of a triangle, with the angle between them set by the correlation.
01The formula
- the standard deviations of X and Y
- the correlation between X and Y, between −1 and 1
- twice the covariance: the extra (or reduced) risk from the two moving together
02See it move
03Where it is used
- Risk managerCombines the risk of two desks into firm-wide risk, which is less than the sum unless the desks are perfectly correlated.
- Portfolio managerAdds a position that is weakly or negatively correlated with the book to lower total risk.
- Market makerHedges inventory in one product with a correlated one; the leftover risk follows this formula with a minus sign.
04Why traders use it
It is the maths of diversification. Risks only add up in full when correlation is 1; below that, part of each risk cancels out.
05Worked example
Desk X has daily risk $1,000 and desk Y $1,500, with correlation 0.30. Together their daily risk is $2,037, less than the $2,500 you get by adding them. If they were uncorrelated it would be $1,803.
06How it is built
- Write .
- Expand the square: .
- The last term is twice the covariance, and .
- This is the law of cosines for a triangle with sides and and angle between them, where .
07The common mistake
Adding standard deviations instead of variances. is only right when ; for independent risks you add the variances and take the square root.
08In Python and LaTeX
import numpy as np sx, sy, rho = 1000, 1500, 0.3 s = np.sqrt(sx**2 + sy**2 + 2 * rho * sx * sy) print(round(s, 2)) # 2037.15
\text{Var}(X + Y) = \sigma_X^2 + \sigma_Y^2 + 2\rho\,\sigma_X \sigma_Y09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.