"Optimal Investment Portfolio Design via Mean-Variance Optimization" by Prakriti Nepal
Optimal Investment Portfolio Design via Mean-Variance Optimization
Prakriti Nepal, William Paterson University of New Jersey

Abstract: Modern portfolio theory poses a deceptively elegant question: given a universe of risky assets, how should a rational investor allocate capital to achieve the greatest possible return for a chosen level of risk? This paper presents a rigorous and self-contained mathematical treatment of mean-variance portfolio optimization, tracing the theory from its two-asset foundations through to the fully general n-asset framework. Beginning with the derivation of portfolio return and variance for two risky assets, we characterize the set of all attainable portfolios and establish that the efficient frontier is one branch of a hyperbola in (σ, μ) space. We solve analytically for the Global Minimum Variance Portfolio (GMVP) using both the method of substitution and Lagrange multipliers and extend these results to n assets using matrix algebra. The introduction of a risk-free asset yields the Capital Allocation Line (CAL), whose slope, the Sharpe ratio, is maximized at the Tangency Portfolio, the unique optimal risky portfolio for all rational investors. We explain the Two-Fund Separation Theorem and illustrate the full pipeline with a step-by-step numerical example using Microsoft, Amazon, and Apple. The paper concludes with a discussion of the Single Index Model as a powerful and parsimonious approach to the estimation problem that underlies large-scale portfolio construction.
1. Introduction
Few problems in applied mathematics have had as profound an impact on human affairs as the question of how to optimally allocate wealth across uncertain investments. The modern answer to this question was given by Harry Markowitz in his landmark 1952 paper, which introduced the mean-variance framework and earned him the Nobel Memorial Prize in Economic Sciences in 1990. Markowitz’s central insight was simple: investors care not only about the expected return of a portfolio, but also about its risk, measured by variance. By formalizing this trade-off, he transformed portfolio construction from an art into a science (Markowitz, 1952; Elton et al., 2014).
The elegance of mean-variance optimization lies in its mathematical precision. The set of all attainable portfolios traces a curve in risk-return space, and the “efficient” portion of this curve—the frontier—represents the best any rational investor can do. Extending the model to include a risk-free asset (such as a U.S. Treasury bill) straightens this frontier into a line, and the point where this line is tangent to the risky efficient frontier identifies the single optimal portfolio of risky assets that all investors, regardless of risk tolerance, should hold.
This paper develops the theory from first principles. Section 2 introduces the two-asset model and derives the portfolio mean, variance, and efficient frontier. Section 3 solves the Global Minimum Variance Portfolio problem analytically using two methods. Section 4 extends the framework to n assets using matrix notation. Section 5 introduces the risk-free asset and derives the Capital Allocation Line and Sharpe Ratio. Section 6 identifies the Tangency Portfolio and talks about the Two-Fund Separation Theorem. Section 7 illustrates the theory with a numerical example. Section 8 discusses the Single Index Model as a direction for future study, and Section 9 concludes. Readers less familiar with linear algebra can follow the core argument through the two-asset case in Sections 2–3 alone; Section 4 onward generalizes the same intuition to n assets using matrix notation, but the underlying economic logic is unchanged.
2. The Two-Asset Portfolio: Setup and Efficient Frontier
2.1 Notation and Setup
Consider a portfolio consisting of two risky assets, 1 and 2. Let μ1 and μ2 denote their expected returns, σ²1 and σ²2 their variances, and σ12 their covariance. The correlation between the two assets is ρ12 = σ12 / (σ1 · σ2). Let x₁ and x₂ denote the portfolio weights allocated to assets 1 and 2, respectively, with the constraint x₁ + x₂ = 1. Short selling—borrowing an asset to sell it now and buy it back later—is permitted, so weights can be negative.
2.2 Portfolio Return and Variance
The portfolio’s expected return is the weighted average of the individual asset returns:
E[Rₚ] = μₚ = x₁μ₁ + x₂μ₂
The portfolio variance, which captures total portfolio risk, is given by:
σ²ₚ = x²₁σ²₁ + x²₂σ²₂ + 2x₁x₂σ₁₂
This expression has three components: the weighted variance of asset 1, the weighted variance of asset 2, and a covariance term that captures the degree to which the two assets move together. This third term is the mathematical engine of diversification: with appropriate values of σ₁₂, and proper combination of asset weights, this covariance term can reduce portfolio variance below what either asset individually provides. This is the quantitative basis for the aphorism that “diversification is the only free lunch in finance.”
2.3 The Efficient Frontier as a Hyperbola
As the weights x₁ and x₂ vary while maintaining x₁ + x₂ = 1, the pair (σₚ, μₚ) traces a curve in risk-return space. An investor seeking to maximize expected return subject to a fixed variance constraint solves:
max μₚ = x₁μ₁ + x₂μ₂
s.t. x²₁σ²₁ + x²₂σ²₂ + 2x₁x₂σ₁₂ = σ²₀ and x₁ + x₂ = 1
The solution traces a curve that is one branch of a hyperbola in (σ, μ) space. The upper branch of this hyperbola constitutes the efficient frontier: the set of portfolios that offer the highest possible expected return for each level of risk. The leftmost point on the curve with the lowest achievable variance is the Global Minimum Variance Portfolio, discussed in the next section.
To see why this curve is a hyperbola, note that substituting the constraint x₂ = 1 − x₁ into the variance formula yields σ²ₚ as a quadratic in x₁, and μₚ as a linear function of x₁. Eliminating the weight parameter gives a quadratic relationship between σ²ₚ and μₚ, precisely the equation of a hyperbola in standard deviation – expected return (σP, µP) space.
3. The Global Minimum Variance Portfolio
The Global Minimum Variance Portfolio (GMVP) is the portfolio that achieves the lowest possible variance among all portfolios on the frontier. It is the leftmost point of the frontier and serves as the floor of attainable risk. Portfolios above the GMVP on the frontier are efficient; those below are inefficient.
3.1 Method I: Substitution
Substituting x₂ = 1 − x₁ into the portfolio variance formula and differentiating with respect to x₁:
dσ²ₚ / dx₁ = 2x₁σ²₁ − 2(1 − x₁) σ²₂ + 2(1 − 2x₁) σ₁₂ = 0
Solving for x₁ yields the closed-form solution:
x₁* = (σ²₂ − σ₁₂) / (σ²₁ + σ²₂ − 2σ₁₂)
x₂* = 1 − x₁*
These are the weights of assets 1 & 2 in the GMVP.
3.2 Method II: Lagrange Multipliers
An equivalent and more elegant approach employs the method of Lagrange multipliers. We form the Lagrangian:
L (x₁, x₂, λ) = x²₁σ²₁ + x²₂σ²₂ + 2x₁x₂σ₁₂ + λ (x₁ + x₂ − 1)
Taking first-order conditions with respect to x₁, x₂, and λ:
∂L/∂x₁ = 2x₁σ²₁ + 2x₂σ₁₂ + λ = 0
∂L/∂x₂ = 2x₂σ²₂ + 2x₁σ₁₂ + λ = 0
∂L/∂λ = x₁ + x₂ − 1 = 0
Subtracting the first equation from the second yields x₂ = x₁ (σ²₁ − σ₁₂) / (σ²₂ − σ₁₂). Substituting into the constraint recovers the same formula as Method I, confirming the result. The Lagrange multiplier λ has a natural economic interpretation: it represents the marginal cost of imposing the budget constraint, i.e., the rate at which minimum variance increases as we tighten the weight restriction.
3.3 A Numerical Example
Suppose asset 1 has expected return μ₁ = 10%, standard deviation σ₁ = 12%, and asset 2 has μ₂ = 16%, σ₂ = 20%, with correlation ρ₁₂ = 0.25. Then σ₁₂ = (0.25) (0.12) (0.20) = 0.006.
Applying the GMVP formula:
x₁* = (0.04 − 0.006) / (0.0144 + 0.04 − 0.012) = 0.034 / 0.0424 ≈ 0.80
So, the GMVP holds approximately 80% in asset 1 and 20% in asset 2, yielding an expected return of 11.2% and a standard deviation of approximately 11.29%—less than either asset individually but with a return still larger than the lowest-yielding asset, namely asset 1. This is the power of diversification made rigorous.

Figure 1. Global Minimum Variance Portfolio
4. Extension to N Assets: Matrix Formulation
4.1 Matrix Notation
For a portfolio of n risky assets, let x = (x₁, …, xN)ᵀ be the vector of portfolio weights, μ = (μ₁, …, μN) ᵀ the vector of expected returns, and Σ the n × n covariance matrix with (Σ)ᵢⱼ = σᵢⱼ. Then:
E[Rₚ] = μₚ = xᵀμ
σ²ₚ = xᵀ Σ x
The GMVP in matrix form solves the problem: min xᵀΣx subject to xᵀ1 = 1, where 1 is a column matrix of 1’s. The analytic solution is:
xGMVP = Σ⁻¹1 / (1ᵀΣ⁻¹1)
4.2 The Efficient Frontier for N Assets
The dual problem minimizing portfolio risk for a target expected return μ₀ is:

4.3 The Geometry of Diversification
Diversification is the fundamental principle underlying Modern Portfolio Theory. Combining assets that are not perfectly correlated reduces overall portfolio risk because gains in one asset may offset losses in another.
As the number of assets increases, the contribution of individual asset variance diminishes while portfolio risk increasingly depends on the average covariance among assets. Consequently, investing in assets with low or negative correlations can substantially reduce overall portfolio risk without sacrificing expected return.

Hence, as n increases:
Variance of individual asset is immaterial
Portfolio variance (risk) converges to average covariance
Average covariance can be reduced by investing in assets that are uncorrelated or negatively correlated.
By such “proper diversification”, an investor can drastically reduce portfolio risk.
5. Introducing the Risk-Free Asset: The Capital Allocation Line
The efficient frontier characterizes the best attainable portfolios from risky assets alone. A profound transformation occurs when we allow investment in a risk-free asset, such as a short-term government bond, with return rf and zero variance.
Let B be any portfolio (or just one asset) with return µB and risk σB, and let f be an uncorrelated risk-free (T-bill) asset with return rf; then any combination portfolio P consisting of B and f will have

The slope of this line, which is the Capital Allocation Line (CAL), (µB - rf ) ̸ σB , is called the Sharpe Ratio and is the risk-premium of asset B. A higher Sharpe ratio implies a steeper CAL and therefore a superior risk-return trade-off for the investor.
6. The Tangency Portfolio and Two-Fund Separation
6.1 The Tangency Portfolio
For a given efficient frontier of risky assets, there are infinitely many possible CALs, one for each risky portfolio. The optimal CAL is the steepest one attainable, i.e., the one with the maximum Sharpe ratio. Geometrically, this is the line from the risk-free rate that is tangent to the efficient frontier. The portfolio on the Efficient Frontier that maximizes the Sharpe Ratio (S) is called the Tangency portfolio, with weights xT given by

The tangency portfolio is the unique portfolio of risky assets that maximizes the Sharpe ratio. Every rational investor, regardless of risk aversion, should hold risky assets in the proportions given by xT, adjusting overall risk by mixing with the risk-free asset.

Figure 2. Tangency Portfolio and Capital Allocation Line
6.2 The Two-Fund Separation Theorem
Any efficient portfolio, a portfolio on the CAL through the tangency portfolio, can be written as a linear combination of (i) the risk-free asset and (ii) the tangency portfolio.
An efficient portfolio E on the tangency CAL satisfies:
μE = rf + xT (μT − rf) and σE = xT σT xT
for some scalar xᴛ ∈ ℝ. The portfolio allocates weight xT to the tangency portfolio T and (1 – xT) to the risk-free asset, which is a linear combination of exactly two funds.
The economic significance of this theorem is profound. It implies that the asset allocation decision separates into two independent separation steps: first, identify the single optimal risky fund (the tangency portfolio); second, choose how much risk to bear by mixing this fund with T-bills. A very risk-averse investor holds mostly T-bills with a small allocation to T; an aggressive investor may even borrow at the risk-free rate to lever up their holding in T.
7. Numerical Illustration: MSFT, AMZN, and AAPL
We now illustrate the full analytical pipeline with a single end-to-end example. Its purpose is not to report empirically measured figures for any real firm, but to show how the abstract matrix formulas of the preceding sections translate into concrete portfolio weights. The three technology stocks below serve only as familiar labels; the return, volatility, and correlation figures are assumed illustrative values, and the computational steps follow the standard matrix procedure (Zivot, 2019). The assumed parameters are Microsoft (MSFT): μ = 10%, σ = 15%; Amazon (AMZN): μ = 12%, σ = 20%; Apple (AAPL): μ = 8.5%, σ = 12% (the covariances are shown in the matrix below); Risk-free rate: rf = 3%.

Step 1: Compute the Excess Return Vector
μ − rf ·1 = [0.070, 0.090, 0.055] ᵀ
Step 2: Solve z = Σ⁻¹ (μ − rf ·1)
z ≈ [2.290, 1.616, 2.708] ᵀ
Step 3: Normalize to Obtain Tangency Weights
sum(z) = 2.290 + 1.616 + 2.708 = 6.614
The tangency weights are wT ≈ 0.346 (MSFT), 0.244 (AMZN), and 0.409 (AAPL).
Step 4: Tangency Portfolio Statistics
μᴛ = wᴛᵀμ = (0.346) (0.10) + (0.244) (0.12) + (0.409) (0.085) ≈ 9.87%
σT = √ (wᴛᵀ Σ wᴛ) ≈ 10.19%
Step 5: Sharpe Ratio
SR = (9.87% − 3%) / 10.19% ≈ 0.674
This Sharpe ratio of 0.674 means the tangency portfolio earns approximately 0.674 units of excess expected return per unit of portfolio standard deviation. An investor who targets a standard deviation of, say, 7% would hold approximately 7/10.19 ≈ 69% in the tangency portfolio and the remaining 31% in T-bills, achieving an expected return of 3% + 0.69 × (9.87% − 3%) ≈ 7.7%.
Figure 3 plots the efficient frontier, the Capital Allocation Line, and the Tangency Portfolio for this three-asset example, situating MSFT, AMZN, and AAPL individually alongside the portfolios that combine them.

Figure 3. Efficient frontier, Capital Allocation Line, and Tangency Portfolio for MSFT, AMZN, and AAPL under the assumed parameters.
8. The Single Index Model: A Direction for Future Study
The full mean-variance framework requires as inputs the n expected returns, n variances, and n(n−1)/2 pairwise covariances. For a portfolio of 200 assets, this amounts to over 20,000 distinct estimates, a practically intractable estimation problem, particularly given the well-documented instability of sample covariance matrices in high dimensions.
The Single Index Model (SIM), proposed by Sharpe (1963), offers a powerful reduction. It assumes that the excess return of any asset i is driven by its exposure to a single common market factor:
Rᵢ = αᵢ + βᵢ · Rᴹ + eᵢ
where Rᴹ is the market return, βᵢ is the asset’s sensitivity to market movements (its “beta”), αᵢ is the asset-specific return independent of the market, and eᵢ is idiosyncratic noise (meaning that this is an asset-specific, random component of return that is unrelated to overall market movements) with E[eᵢ] = 0 and Cov (eᵢ, Rᴹ) = Cov (eᵢ, eⱼ) = 0 for all i ≠ j.
Under these assumptions, the expected return, variance, and covariance of any asset simplify to:
μᵢ = αᵢ + βᵢμᴹ
σ²ᵢ = β²ᵢσ²ᴹ + σ²ei (systematic + idiosyncratic risk)
σᵢⱼ = βᵢβⱼσ²ᴹ (all co-movement flows through the market)
These three results mean that the entire covariance structure of n assets can be recovered from just n alphas, n betas and n idiosyncratic variances (plus the two market parameters μᴹ and σ²ᴹ). The total number of estimates needed falls from n + n(n−1)/2 to 3n + 2. For 200 assets, this is a reduction from 20,300 inputs to just 602, a compression of over 97%. Moreover, each αᵢ and βᵢ can be estimated robustly via a simple ordinary least-squares regression of asset i’s returns on the market index, a procedure that is both transparent and statistically sound.
The Single Index Model thus bridges the gap between theoretical elegance and practical implementation and represents a natural direction for extending the present analysis.
9. Conclusion
This paper has developed the mean-variance framework for optimal portfolio construction from first principles. Beginning with the two-asset case, we derived the efficient frontier as a hyperbola in risk-return space and solved analytically for the Global Minimum Variance Portfolio using both substitution and Lagrange multipliers. We extended these results to n assets using matrix algebra, demonstrating that under broad diversification, the contribution of individual variances diminishes while average covariance becomes the dominant determinant of portfolio risk.
The introduction of the risk-free asset transformed the efficient frontier into the Capital Allocation Line, whose slope, the Sharpe ratio, measures risk-adjusted performance. Maximizing the Sharpe ratio over the risky efficient frontier identifies the Tangency Portfolio, and the Two-Fund Separation Theorem establishes that all rational investors should hold risky assets in the proportions of this single portfolio, adjusting overall risk by mixing with T-bills. A step-by-step numerical example with three technology stocks illustrated the full analytical pipeline.
The key takeaways of the theory are worth stating plainly. First, diversification is not merely intuitive but mathematically necessary: covariances among assets, not individual variances, govern the risk of a large portfolio. Second, the efficient frontier provides a precise map of the best available risk-return combinations, and no rational investor should hold a portfolio below it. Third, when a risk-free asset exists, all rational investors converge on the same portfolio of risky assets, the tangency portfolio, a striking result that unifies individual behavior with market equilibrium. Finally, the Single Index Model shows that the practical estimation problem, while formidable in its raw form, can be dramatically simplified through structural assumptions about the sources of co-movement.
These results form the mathematical foundation of modern asset management, from mutual fund construction to risk parity strategies (which balance risk contributions evenly across holdings) to the Capital Asset Pricing Model (CAPM). The journey from a two-asset covariance matrix to the structure of global capital markets begins here.
References
Cornuejols, G., Peña, J., & Tütüncü, R. (2018). Optimization Methods in Finance (2nd ed.). Cambridge University Press.
Elton, E. J., Gruber, M. J., Brown, S. J., & Goetzmann, W. N. (2014). Modern Portfolio Theory and Investment Analysis (9th ed.). Wiley.
Markowitz, H. (1952). Portfolio selection. The Journal of Finance, 7(1), 77–91.
Sharpe, W. F. (1963). A simplified model for portfolio analysis. Management Science, 9 (2), 277–293.
Sharpe, W. F. (1966). Mutual fund performance. The Journal of Business, 39(1), 119–138.
Zivot, E. (2019). Lecture Notes on Computational Finance and Econometrics. University of Washington.



Comments