# method for calculating portfolio volatility

I am trying to figure out the method for calculating the portfolio volatility using matrices. I have read online the following definition for calculating the portfolio volatility using matrix algebra

The variance of a portfolio of correlated assets can be written as WTvW, where W is a column vector (ie a matrix with a single column) containing the weights of different assets in the portfolio. V is the covariance matrix, and WT is the transpose of the matrix W.

I have tried to calculate this on a spreadsheet, but am not sure if i have done it correctly. More specifically, im not sure if i am multiplying the vectors with the covariance matrix correctly.

Can someone please confirm my calculation I have used commas below to separate the different values in the vector and matrix

assuming my weights vector is 0.89, 0.11 my covariance matrix is a 2x2 matrix = 1 , 0.674571 0.674571, 1

to calculate the result i first multiply my weights vector with the covariance matrix

i.e 0.89*1 + 0.11*0.674571
and 0.89*0.674571 + 0.11*1

which gives the following vector A 0.964202851 0.710368523

I then multiply vector A with the weights vector, i.e

0.964202851 * 0.89 0.710368523 0.11 = 0.964202851*0.89+0.710368523 *0.11 = 0.936281075

Is this correct, or do i have an error in my calculation

Your calculation is correct. By the way, there are free software packages available that make it easier to do these kinds of calculations. For example, using Octave, you simply type

V=[1, .674571; .674571, 1]
W=[.89;.11]
W'*V*W


and it will give you the answer:

ans =  0.93628


Let $R \in \mathbb{R}^d$ and $w \in \mathbb{R}^d$ denote the asset returns and portfolio allocation, respectively. Assuming that $w$ is deterministic, then the portfolio return is given by $r_p = R^\prime w$, such that $$Var(r_p) = Var(R^\prime w) = w^\prime Var(R)w = w^\prime \Sigma w$$ where $\Sigma = Var(R)$ is the covariance matrix of asset returns.

You can calculate the same without matrix notation, which is less tractable, nonetheless: $$r_p = \sum_{i=1}^d w_i \times R_i$$ such that $$Var(r_p) = Var(\sum_{i=1}^d w_i \times R_i) = \sum_{i=1}^d w_i^2 Var(r_i) + \sum_{i \neq j}^d w_i w_j Cov(r_i,r_j)$$