Matrix multiplication combines portfolio weights, asset returns, volatilities, and correlations into compact calculations. It replaces explicit summations and double summations with readable, efficient operations. section 2.2 section 2.9
For weights w and expected asset returns μ, the expected portfolio return is the dot product μᵀw. In NumPy, the @ operator expresses this directly. With weights [0.2, 0.3, 0.5], the demonstrated portfolio return is 9.5%. section 2.2
The same pattern handles risk. Multiplying a diagonal volatility matrix, a correlation matrix, and its transpose produces the covariance matrix; multiplying wᵀ, Cov, and w produces portfolio variance, whose square root is standard deviation.
Portfolio return and risk
Represent FE, WMT, and AAPL with weights and asset statistics. Evaluate μ @ w.T for expected return, then compute (w @ Cov @ w.T) ** 0.5 for portfolio standard deviation. These outputs support comparisons among portfolios seeking higher returns for a given risk. section 2.2







