RSJ Portfolio Create a statistically optimized portfolio

← All posts

2026-11-14

Minimum Variance Portfolio Weights: The Formula, Explained

Minimum Variance Portfolio Weights: The Formula, Explained
portfolio optimization modern portfolio theory portfolio correlation portfolio optimization hierachical risk parity minimize volatility minimize semivariance maximize sharpe

Minimum Variance Portfolio Weights: The Formula, Explained

If you hold more than one stock, you have already made a portfolio decision — but probably not a deliberate one. Equal weighting is the accidental default: split the money, hope the diversification works. The minimum variance portfolio weights formula is the alternative. It answers one narrow, well-posed question: for this set of assets, which weights produce the smallest possible total volatility?

No return forecast, no market view, no opinion about which stock will win. Just a covariance matrix and one closed-form solution. In this article we’ll unpack the formula in plain language, walk through the matrix algebra, work a two-asset example by hand, and then look at how RSJ Portfolio turns it into a managed workflow instead of a scripting project.

What the Minimum Variance Portfolio Weights Formula Actually Solves

The minimum variance portfolio is the allocation that minimizes total portfolio volatility for a given set of assets. “Given” is doing a lot of work there: you supply the candidate list, the historic price data and the resulting covariance structure. The formula supplies the weights.

Stated in words: the optimal weights are proportional to the inverse covariance matrix applied to a vector of ones, then normalized so they sum to one.

That’s the whole idea. Two inputs, one output:

  • Input: a covariance matrix Σ of asset returns, typically estimated from historic prices.
  • Output: one weight per asset, summing to 1, that minimizes portfolio variance.

Why bother, when equal weighting exists? Because equal weighting treats assets as if they were interchangeable. It gives the same 20% to a stock that marches in lockstep with the rest of the book and to one that moves independently. The formula doesn’t. It looks at how assets move together — the off-diagonal entries of the covariance matrix — and shifts capital toward the combinations that cancel each other out.

A quick intuition check. Take two stocks with identical volatility. If their returns are uncorrelated, the minimum variance solution is close to 50/50. If they are strongly correlated, you get less diversification benefit from holding both — and if one is materially less volatile, the formula tilts hard toward it. Equal weighting can’t express any of that. The formula can.

A Plain-Language Analogy: Diversification as a Team Sport

Think of each asset as a player and the portfolio as the lineup. You don’t want the eleven best individual players; you want the eleven whose combined performance varies least from week to week.

Correlation is form that moves together. Two strikers who both go quiet in the same matches are, for squad-building purposes, nearly the same striker — fielding both doesn’t reduce the variance of your results. The formula notices this and gives less weight to players who duplicate each other’s bad days.

It also rewards the player who zigs when the others zag, even if his individual form is noisier. A volatile asset with genuinely weak correlation to the rest of the book can earn a meaningful weight, because its wobble partly cancels other wobbles.

The covariance matrix is the team’s coordination map: variances on the diagonal (how erratic each player is on his own) and covariances off the diagonal (how much their form moves together). The formula reads the map and picks the lineup.

Under the Hood: From Covariance Matrix to Optimal Weights

Here’s the closed form:

w = (Σ⁻¹ · 1) / (1ᵀ · Σ⁻¹ · 1)

Symbol by symbol:

  • Σ — the covariance matrix of asset returns, n × n. Diagonal entries are variances; off-diagonal entries are pairwise covariances.
  • Σ⁻¹ — its inverse. This is the interesting part.
  • 1 — a column vector of ones, length n.
  • Σ⁻¹ · 1 — a raw, unnormalized weight vector.
  • 1ᵀ · Σ⁻¹ · 1 — a scalar. Dividing by it forces the weights to sum to exactly 1.

Why the inverse rather than the covariance matrix itself? Because inversion mixes variances and correlations into a single “how much independent information does this asset carry?” measure. An asset whose returns are largely explained by other assets in the set gets penalized; an asset carrying unique variation gets rewarded. That’s precisely the diversification effect, expressed as linear algebra.

A two-asset example you can do on paper

For two assets the formula collapses to:

w₁ = (σ₂² − ρ·σ₁·σ₂) / (σ₁² + σ₂² − 2·ρ·σ₁·σ₂)

Take σ₁ = 20%, σ₂ = 30%, and a correlation of ρ = 0.2:

  • numerator: 0.09 − 0.2 × 0.20 × 0.30 = 0.078
  • denominator: 0.04 + 0.09 − 2 × 0.2 × 0.20 × 0.30 = 0.106
  • w₁ ≈ 74%, w₂ ≈ 26%

The less volatile asset gets most of the capital, as you’d expect — but not all of it, because the weak correlation still buys something.

Now raise the correlation to ρ = 0.9:

  • numerator: 0.09 − 0.054 = 0.036
  • denominator: 0.13 − 0.108 = 0.022
  • w₁ ≈ 164%, w₂ ≈ −64%

A short position. Same two assets, same volatilities — only the correlation changed. This is the single most important thing to understand about the formula: it does not know or care whether its output is investable. Long-only limits, position caps and similar bounds turn the closed form into a constrained optimization problem, which is why practitioners rarely run the raw formula on real money.

The formula in code (for understanding, not for production)

import numpy as np

# returns: T x n array of daily returns, columns aligned with tickers
sigma = np.cov(returns.T, ddof=1)
ones = np.ones(sigma.shape[0])

raw = np.linalg.inv(sigma) @ ones
w = raw / raw.sum()

print(dict(zip(tickers, w.round(4))))

Three practical hurdles appear the moment you run something like this for real:

  1. Covariance estimation error. With n assets you are estimating n(n+1)/2 parameters from a finite sample. Weights are notoriously sensitive to that error — small changes in the sample period can move them a lot.
  2. Positive definiteness. The inverse only behaves if Σ is invertible and well-conditioned. Shrinkage estimators (for example toward a structured target) and recentred or cleaned return series help; near-duplicate assets wreck it.
  3. Constraints. Long-only bounds and position caps require a quadratic program rather than a matrix inverse.

One last framing point: minimum variance is a special case of mean-variance optimization in which expected returns are set to zero or ignored entirely. That’s a feature, not a shortcut — return forecasts are the noisiest input in the whole framework. Our comparison of maximum Sharpe ratio vs minimum semivariance allocation digs into what changes when you do bring returns or downside measures into the objective.

Why It Matters and Common Misconceptions

The case for minimum variance is robustness. Because it never forecasts returns, it never compounds a bad forecast across every position. In practice this tends to produce allocations that hold up better out of sample than return-driven optimizers — less spectacular, less fragile.

Three misconceptions worth clearing up.

Misconception 1: “minimum variance” means minimum risk in every sense. It minimizes volatility — the standard deviation of returns. It says nothing directly about maximum drawdown, tail losses or path-dependent risk. A portfolio can be volatility-optimal and still experience an unpleasant drawdown. If tail risk is what worries you, conditional value at risk is the more relevant objective.

Misconception 2: the formula always gives intuitive weights. The ρ = 0.9 example above shows otherwise. Strong correlations and estimation noise can push weights to extremes, including shorts. If the output looks bizarre, the input data is usually telling you something real about redundancy in your candidate list.

Misconception 3: compute once, forget forever. Weights drift as prices move, and the covariance matrix itself changes as correlations regime-shift. Minimum variance weights are a snapshot of a moving target. Periodic recomputation and rebalancing — quarterly, or when correlations visibly shift — is part of the method, not an afterthought.

How RSJ Portfolio Applies the Formula in Practice

RSJ Portfolio is a Windows desktop application that builds a statistically optimized stock portfolio from historic end-of-day prices. It analyses the return correlation between stocks and allocates capital to candidates that correlate weakly — or whose downside correlates weakly — which reduces the volatility of the resulting portfolio. That is the minimum variance idea, applied end to end.

Allocation uses modern portfolio theory, with the objective, the risk estimator and the weight constraints all selectable. Minimum volatility is one objective among several; alongside it you get eight risk models, return models, weight constraints and exports, so the raw formula can be shaped into something you can actually hold.

The workflow is managed rather than coded:

  • Select the symbols that form your candidate list. If you want help narrowing that list first, see how to scan a watchlist for low-correlation stocks.
  • Configure the data provider, date range, local currency and cleaning settings.
  • Run the optimizer with minimum volatility as the objective.
  • Review the resulting allocation.

No manual matrix algebra, no hand-rolled covariance estimation, no separate script to reconcile currencies. For the statistical background behind the optimizer, the user guide’s concept page covers the methods in more depth than this article does.

From Formula to Portfolio: A Managed Workflow

The hard way is: source end-of-day prices for every candidate, clean corporate actions and gaps yourself, align trading calendars, convert currencies, estimate a covariance matrix, invert it, handle the cases where it isn’t positive definite, add constraints, re-solve as a quadratic program, and then rebuild the whole pipeline when your data vendor changes a field name. It’s a week of work and a permanent maintenance liability.

The managed way, inside RSJ Portfolio:

  1. Install the application from the downloads page. The installer’s SHA-512 is published alongside it so you can verify the download.
  2. Set your local currency and date range. Both live in the configuration area; the date range drives the covariance estimate, so it deserves a deliberate choice rather than the default.
  3. Build the candidate list from symbol search.
  4. Choose minimum volatility as the objective and, if you want, add weight constraints to keep the solution investable.
  5. Run the recommendation and read the resulting allocation.

Price cleaning, local caching and multi-currency conversion are handled as part of that workflow rather than as separate chores. Multi-currency matters more than it sounds: if your candidates trade in different currencies, the portfolio’s volatility depends on the currency-converted return series, not on the local ones. The getting-started guide covers recommended starting parameters and how to read the results, and first-run setup walks through the configuration choices before your first run.

When you’re satisfied with an allocation, you can pull the weights out — the export workflow is covered in exporting optimized portfolio weights to a spreadsheet, and if you want to sanity-check the numbers independently, so is verifying an optimizer’s allocation results.

FAQ

What inputs does the minimum variance formula require?

It requires a covariance matrix of asset returns, typically estimated from historic price data. You also need a way to invert that matrix and normalize the resulting weights so they sum to one.

Can I use the formula with only a few stocks?

Yes, but with very few assets the covariance matrix is small and estimation error can dominate. The formula still works mathematically, but the resulting weights may be unstable and sensitive to the sample period.

How often should I recompute minimum variance weights?

There is no single answer. Weights drift as prices move, and the covariance matrix changes over time. Many practitioners recompute periodically — for example quarterly or when correlations shift — and rebalance accordingly.

Does RSJ Portfolio let me apply weight constraints to the minimum variance solution?

Yes. RSJ Portfolio lets you select the objective (including minimum volatility) and apply weight constraints, so the optimizer can respect limits you set rather than producing unconstrained weights.

Conclusion

The minimum variance portfolio weights formula is one line of linear algebra with an outsized practical payoff: it replaces the accidental 1/n default with an allocation that actually accounts for how your assets move together. Its strengths and weaknesses both come from the same place — it ignores return forecasts entirely. That makes it robust, and also makes it blind to drawdowns and capable of producing weights no sane investor would hold unconstrained.

Understand the formula, then let the tooling do the arithmetic. RSJ Portfolio applies it as a managed workflow on Windows: pick your symbols, set the currency and date range, choose minimum volatility, and read the allocation — with price cleaning, caching and multi-currency conversion handled for you. Install it, run one recommendation on a candidate list you already know well, and compare the weights against what you’re holding today.

Related posts

EU label: AI-generated content