A question about the associative law of matrix

116 Views Asked by At

Acoording to the associative law of the matrix, the following equation $\mathbf{1}^H\mathbf{D_0}^{-1}\mathbf{D_0}^{-H}\mathbf{1} =\mathbf{1}^H(\mathbf{D_0}^{-1}\mathbf{D_0}^{-H})\mathbf{1} $, where $\mathbf{1}$ is a vector of length $M$, $\mathbf{D_0}$ is a matrix of size $M\times M$ and $^H$ is the complex conjugate transpose.

But when I tried it in MATLAB, they are not equal. Why would that happen? The second picture is the value of $\mathbf{D_0}$.

enter image description here

enter image description here

1

There are 1 best solutions below

1
On BEST ANSWER

I have tried to reproduce your error with this program and a random $8 \times 8$ complex matrix :

M=8;D_0=rand(M)+i*rand(M);
p=ones(1,M)*D_0^(-1)*inv(D_0')*ones(M,1)
q=ones(1,M)*(D_0^(-1)*inv(D_0'))*ones(M,1)

It has always given the same value for $p$ and $q$.

Therefore, I suspect your matrix to be either non-invertible or close to be such (if you have what is called a high "condition number"). So I decided to take a non invertible matrix with rank $7$ instead of $8$ ; here is how (this line replaces the first line of the previous program):

r=M-1;P=rand(M,r)+i*rand(M,r);D_0=P*P';% rank D_0=r

This time, $p$ and $q$ are different numbers, in fact with the same real part, but a different imaginary part.

Explanation : neither $D_0^{-1}$ nor $inv(D_0')$ exist in such a case...

So, what you have to ask to Matlab is $\det(D_0)$ and cond$(D_0)$. If the first one is close to $0$ (for example $10^{-10}$) or the second one very big (for example $10^{-15}$), this is practicaly equivalent to non inversibility of $D_0$.