Calculation contract
w1* = (v2 - c12) / (v1 + v2 - 2*c12); w1 = clip(w1*, 0, 1); w2 = 1 - w1| Input | Allowed values | Meaning |
|---|---|---|
| covariance | Symmetric PSD 2x2 matrix; entries -100 to 100 | Squared decimal-return units; nonnegative diagonal; one frequency |
Method and interpretation
For the default matrix the unconstrained first weight is 0.004/0.038, approximately 10.5263%. It is inside the long-only interval, so no clipping changes the result. The second exposure receives the remainder.
With two assets and a valid covariance matrix, portfolio variance is a convex quadratic in the first weight. A boundary solution is therefore represented by clipping the analytic stationary point. If the difference variance is exactly zero, all feasible weights tie and the card explicitly returns equal weights with unique=false.
Where the reference stops
This closed-form reference is not a general optimizer. It excludes expected return targets, shorting, taxes, turnover penalties and estimation uncertainty. Near-degenerate matrices can make the unconstrained weight unstable even while the constrained answer is finite.
Published synthetic inputs
{
"covariance": [
[
0.04,
0.006
],
[
0.006,
0.01
]
]
}Frozen calculation output
{
"weights": [
0.10526315789473684,
0.8947368421052632
],
"unconstrained_weight_1": 0.10526315789473684,
"variance": 0.009578947368421053,
"unique": true
}Long-only two-asset variance minimization; expected returns and costs excluded.
Verification coverage
- Analytic weights checked against independent quadratic calculations and feasible-grid minima.
- Boundary clipping and equal-risk tie rule tested; indefinite matrices rejected.
Unit and independent-reference checks test arithmetic and rejection rules, not future investment performance.
Method references
Read the assumptions in context
Allocation referencesTwo-Asset Minimum Variance Depends on the Feasible Weights
A closed-form minimum can imply shorting or leverage. Long-only and allocation bounds change the answer without changing the covariance inputs.
Statistical estimationCovariance Shrinkage Is a Choice of Target, Not Just Intensity
The same shrinkage intensity can preserve individual variances, pull them together or impose factor structure. Those choices produce different risk estimates and allocations.