I am currently going through a financial book that covers some matrix multiplication but I am not certain which operation is occurring to get this result. The book provides spreadsheets so I can see the result and therefore deduce what is happening but I don't know whether the math is correct or something else.

The book is taking a [1xn] vector and multiplying this by an [nxn] matrix and then multiplying it by an [nx1] vector (whether first vector is [nx1] or [1xn] is not indicated by the book, same for the last vector).

The literal formula provided by the book is $\Sigma = \sigma.\rho.\sigma^T$ where $\Sigma$ is the covariance matrix, $\sigma$ is the vector of standard deviations, $\rho$ is the correlation matrix.

The following are the inputs and outputs, assuming $\sigma$ is a row vector:

$\Sigma = \begin{bmatrix}\sigma_1 & \sigma_2\end{bmatrix} . \begin{bmatrix}\rho_{1,1} & \rho_{1,2}\\\rho_{2,1} & \rho_{2,2}\end{bmatrix} .\begin{bmatrix}\sigma_1\\\sigma_2\end{bmatrix} = \begin{bmatrix}\rho_{1,1}\sigma_1\sigma_1 & \rho_{1,2}\sigma_1\sigma_2\\\rho_{2,1}\sigma_2\sigma_1 & \rho_{2,2}\sigma_2\sigma_2\end{bmatrix}$

With a dot product (to my understanding), the dimensions of the matrix and vectors would result in a single scalar, not a matrix. If the dimensions of the vectors were flipped (column vector then row vector), the dot product would be impossible due to the different number of columns in the vector as rows in the matrix.

Any help is greatly appreciate! I apologize if this is a simple problem but this has been puzzling me for awhile now.

  • 3
    $\begingroup$ My best guess is they somehow miswrote the answer, which should be the sum of the four entries of the rightmost matrix. Maybe they are using some mnemonic to get those four entries and forgot to add them? $\endgroup$
    – pancini
    Nov 17, 2023 at 23:57
  • 1
    $\begingroup$ If $\sigma$ was a diagonal matrix instead of a vector the algebra would work out. $\endgroup$ Nov 18, 2023 at 1:12

1 Answer 1


This looks to me like element wise multiplication, similar to how broadcasting works in computer science.

More precisely, I can define a row vector times a matrix by allowing each element of the row vector to scale the corresponding column of the matrix. Similarly, a column vector times a matrix will scale the rows of the matrix by each element in the column vector.

Mathematically, this is nothing more than right or left multiplication by the diagonal matrix built from the vector. In more mathematical notation, you have something like

$$ \Sigma = \color{blue}{\sigma} .\rho .\color{green}{\sigma^T} = \color{green}{Diag(\sigma)}\,\rho\, \color{blue}{Diag(\sigma)},$$

so that the first multiplication scales the rows (hence represents column vector times matrix) and the second multiplication scales the columns (hence represents row vector times matrix).

  • 2
    $\begingroup$ $+\tt1\:$ You can also write this as the elementwise/Hadamard product between the outer product of standard deviations vectors and the correlation matrix, i.e. $\:\sigma\sigma^T\odot\large\rho\;$ $\endgroup$
    – greg
    Nov 18, 2023 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .