Build a Mean-Variance Objective for a Single-Period Portfolio
Statistics & ExperimentsModel answerLast updated
Derive and explain the classic mean-variance trade-off objective, covering term definitions, units, risk-aversion role, and convexity conditions.
Build a Mean-Variance Objective for a Single-Period Portfolio
You are designing the core objective function for a single-period portfolio optimizer. The optimizer selects a vector of target positions to trade off expected return against risk — without yet worrying about transaction costs or turnover constraints.
Your task: Write down the objective function, define every symbol precisely, explain how units must be consistent across terms, describe what the risk-aversion parameter controls, and state the conditions under which the problem is convex (or concave, depending on how you frame it).
Given quantities
| Symbol | Meaning |
|---|---|
h | Vector of target holdings (e.g., dollar values, share counts, or portfolio weights) |
alpha | Vector of expected returns, in units compatible with h |
Sigma | Symmetric positive-semidefinite covariance matrix of returns |
lambda | Risk-aversion parameter (scalar) |
Feasibility constraints (budget, long-only, leverage limits, etc.) are out of scope here — focus only on the objective.
What your answer should cover
- The explicit formula for the objective, in both maximization and minimization forms.
- A precise definition of each term, including its units.
- The role of
lambdaand how changing it shifts the solution. - Why the problem is convex (or concave), and what property of
Sigmaguarantees that. - Common pitfalls — especially around the optional one-half convention and dimensional inconsistency.
Clarifying questions a strong candidate raises
- Are holdings in dollars, shares, or fractions of capital? The answer affects how
alphaandSigmamust be scaled. - Does
alpharepresent a return forecast (dimensionless) or an expected profit in currency units? - Do
alphaandSigmashare the same time horizon? - Is the one-half factor in front of the variance term a convention choice, or is it fixed by the problem spec?
Hints
Hint 1
Start by writing the expected portfolio return as a dot product, then express portfolio variance as a quadratic form — only then combine them with the risk-aversion scalar.
Hint 2
Check units term by term: if h is in dollars and alpha is a fractional return, then alpha^T h is in dollars; Sigma must then be in (return)^2 so that lambda * h^T Sigma h is also in dollars — otherwise the subtraction is meaningless.
Hint 3
Concavity of the objective (when maximizing) follows directly from Sigma being positive semidefinite: the quadratic penalty is convex in h, so negating it to subtract from the linear term yields a concave function.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Objective Function
The standard single-period mean-variance objective written as a maximization problem is:
maximize f(h) = alpha^T h - lambda * h^T Sigma h
Some texts include a one-half factor on the quadratic term:
maximize f(h) = alpha^T h - (lambda / 2) * h^T Sigma h
Both are valid — the one-half form makes the gradient cleaner (grad f = alpha - lambda * Sigma * h instead of alpha - 2 * lambda * Sigma * h), and the two are equivalent up to rescaling lambda. Pick one convention and state it explicitly; mixing them is a common source of off-by-two errors in gradient derivations.
The equivalent minimization form (useful for standard convex solvers) negates the objective:
minimize -alpha^T h + lambda * h^T Sigma h
Term Definitions
h (n × 1): Target holdings vector. Each entry represents a position in one asset. The choice of units — dollars invested, number of shares, or fraction of total capital — is a design decision, but it must be consistent across all terms.
alpha (n × 1): Expected return (or expected profit) per unit of holding. If h is in dollars and alpha is a dimensionless fractional return, then alpha^T h has units of dollars — the expected portfolio profit. If h is in shares, alpha should be expected price change per share, again yielding dollars.
Sigma (n × n): Covariance matrix of asset returns over the optimization horizon. It must be symmetric and positive semidefinite. Its units are (return units)^2, so that h^T Sigma h has the same units as alpha^T h — otherwise subtracting the two is dimensionally incoherent.
lambda (scalar ≥ 0): Risk-aversion parameter. It is dimensionless when units are set up correctly, acting as an exchange rate between one unit of expected return and one unit of variance. A higher lambda penalizes variance more heavily, pushing the optimizer toward lower-risk positions. As lambda → 0 the solution is the maximum-expected-return portfolio (ignoring risk entirely); as lambda → ∞ the solution converges to the minimum-variance portfolio (ignoring return entirely). Sweeping lambda traces out the efficient frontier.
Convexity
The objective f(h) = alpha^T h - lambda * h^T Sigma h is concave in h when lambda ≥ 0 and Sigma is positive semidefinite (PSD).
- The term
alpha^T his linear, hence both convex and concave. - The term
h^T Sigma his a quadratic form. BecauseSigmais PSD, this quadratic form is convex inh. - Subtracting a convex function from a (linear + concave) function yields a concave function.
Maximizing a concave function over a convex feasible set is a convex optimization problem — it has no local maxima that are not global, and standard solvers (CVXPY, OSQP, Gurobi) handle it directly.
If Sigma were only positive semidefinite (not definite), the objective is still concave but the solution may not be unique along directions in the null space of Sigma. In practice this is handled by adding a small diagonal regularizer (Sigma + epsilon * I) or imposing binding constraints.
Dimensional Consistency Checklist
| Term | Units (example: h in $) |
|---|---|
alpha^T h | fractional return × $ = $ |
h^T Sigma h | $^2 × (return)^2 / $^2 = (return)^2 × $^2 ... |
Wait — this reveals the subtlety. If h is in dollars and Sigma is the covariance of fractional returns, then h^T Sigma h is in dollars-squared, not dollars. So lambda must carry units of 1/$ to make lambda * h^T Sigma h comparable to alpha^T h in dollars. Many practitioners avoid this by normalizing h to portfolio weights (dimensionless fractions summing to 1), which makes every term dimensionless and lambda a pure scalar.
Common Mistakes
- Forgetting the sign on the penalty. Writing
alpha^T h + lambda * h^T Sigma hand then maximizing is maximizing more risk, which is the opposite of the intent. - Mixing the one-half convention. Deriving a gradient that assumes the factor and then using a solver that assumes it doesn't (or vice versa) means
lambdahas a factor-of-two error baked in. - Ignoring the horizon mismatch. Using a daily
alphawith a monthlySigmainflates the risk penalty by roughly a factor of 20 (≈ 21 trading days), making the optimizer far more conservative than intended. - Treating
lambdaas a constraint. A common misframing is to say "lambda controls the maximum risk." It doesn't directly — it controls the trade-off rate. To impose a hard risk cap, add a constrainth^T Sigma h ≤ sigma_max^2separately.