Search code examples
matlabmatrixmatrix-inverse

calculate minus power of given matrix in matlab


suppose that we have following formulas

enter image description here

let say we have some matrix

A=rand(3,3)

A =

    0.3922    0.7060    0.0462
    0.6555    0.0318    0.0971
    0.1712    0.2769    0.8235

i have calculate eigenvalue decomposition

[V,D]=eig(A)

V =

    0.6174   -0.4576   -0.3467
   -0.7822   -0.3723   -0.2087
    0.0841   -0.8075    0.9145


D =

   -0.4960         0         0
         0    1.0481         0
         0         0    0.6954

then clearly

V*D*inv(V)

ans =

    0.3922    0.7060    0.0462
    0.6555    0.0318    0.0971
    0.1712    0.2769    0.8235

about second formula i have tried following one

V*sqrt(inv(D))*V'

ans =

   0.3487 + 0.5412i   0.2532 - 0.6857i  -0.0193 + 0.0737i
   0.2532 - 0.6857i   0.1876 + 0.8687i   0.0648 - 0.0934i
  -0.0193 + 0.0737i   0.0648 - 0.0934i   1.6397 + 0.0100i

is it correct implementation? or how to calculate given power of D in matlab ? thanks in advance


Solution

  • Your formula is correct.

    However, it is not expected to get A matrix back from second formula of:

    enter image description here

    The inversion of the diagonal matrix D is basically the inversion of each diagonal element separately. Meaning that D^(-1) = diag(1/d_ii)

    So, the operation's steps can be defined also with the following procedure:

    • the diagonal nonzero elements are extracted in a column
    • invert each one separately
    • compute sqrt of each one
    • recreate the diagonal matrix.

    The operation described above will look like this: V*diag(diag(D).^(-0.5))*V'

    The element d_11=-0.496 is the problem. As a negative value, its sqrt will be a complex number. So D.^(-0.5) will be a complex matrix and the product will be a complex matrix.

    Are you sure the formula is applied to any random matrix? According to my thought it might apply to some special form of the matrix like symmetric and/or positive definite.