0
$\begingroup$

I know in general, matrix multiplication is not commutative, but would it be true in this special case?

$D A P D^T = A D P D^T$ where $A, D, P$ are all $n by n$ matrix. But $P$ is symmetrical and positive definite matrix and $D$ is diagonal

The context of my problem is that I have a covariance matrix $P$. I want to "scale" the standard deviation inside the matrix. i.e if $P_{ij} = \rho_{ij} \sigma_i \sigma_j $ I want to make it $\rho_{ij} d_i d_j \sigma_i \sigma_j $ where $d_i$ is the entries on the diagonal matrix $D$.

I am wondering if I "scale" my matrix before the product, is it equivalent of scaling the matrix after the product?

$\endgroup$
1
  • 1
    $\begingroup$ did you try small examples, like 2x2 and 3x3? $\endgroup$
    – Steen82
    Commented Jun 22 at 15:28

1 Answer 1

1
$\begingroup$

No, this is incorrect. Consider the following matrices $$D = \begin{pmatrix}2 & 0 \\ 0 & 3\end{pmatrix}, \quad A = \begin{pmatrix}1 & 1 \\ 0 & 1\end{pmatrix}, \quad P = \begin{pmatrix}2 & 1 \\ 1 & 2\end{pmatrix}.$$

$D$ is indeed diagonal, and $P$ is indeed symmetric positive-definite since it is symmetric and has eigenvalues $1$ and $3$ (which are both strictly positive).

Then, you can verify that $$DAPD^T = \begin{pmatrix}12 & 18 \\ 6 & 18\end{pmatrix} \neq \begin{pmatrix}14 & 24 \\ 6 & 18\end{pmatrix} = ADPD^T.$$

More intuitively, if you consider the more restrictive case where $D$ is invertible (i.e. it has no zero on its diagonal), then what you are asking is whether $DAPD^T = ADPD^T \iff DA = AD$. However, you have that $$(DA)_{ij} = \sum_k D_{ik} A_{kj} = D_{ii} A_{ij},$$ $$(AD)_{ij} = \sum_k A_{ik} D_{kj} = A_{ij} D_{jj} = D_{jj} A_{ij},$$ which are clearly not equal in general.

$\endgroup$

You must log in to answer this question.

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