m123416
m123416

Reputation: 3

Is polar decomposition commutative for tridiagonal matrices?

I did a error while understanding about the polar decompositon. I thought polar decomposition is PU, but it is UP. While trying to understand what went wrong, I realized that it is somewhat commutative for the inputs I am giving to it because of which I could not realize about this big mistake. It would be great if someone can explain about this so that I can understand whether it is commutative for all tridiagonal matrices? Are there any polar decomposition formula where polar decomposition is PU? Thank you for great help.

import numpy as np
from scipy.linalg import polar
A= np.array([[-2, 1, 0, 0],
              [1, -2, 1, 0],
              [0, 1, -2, 1],
              [0, 0, 1, -2]])
U, P = polar(A)
print(U)
print(P)
A1 = U @ P
print(A1)
A2 = P @ U
print(A2)
are_equal = np.allclose(A1, A2)
print("Are matrix equal:", are_equal)

Upvotes: 0

Views: 60

Answers (1)

Nick ODell
Nick ODell

Reputation: 25409

The matrix you've posted is symmetric, and real-valued. (In other words, A = A.T, and it has no complex numbers.) This matters because all matrices which are symmetric and real-valued are normal matrices. Source. If the matrix is normal, then any polar decomposition of it follows P @ U = U @ P. Source.

Any square diagonal matrix is also symmetric. Source. However, technically the matrix you have posted is not diagonal - it has entries outside its main diagonal. The matrix is only tri-diagonal. These matrices are not necessarily symmetric. However, if your tridiagonal matrix is symmetric and real-valued, then its polar decomposition is commutative.

In addition to mathematically proving this idea, you can also check it experimentally. The following code generates thousands of matrices, and their polar decompositions, and checks if they are commutative.

import numpy as np
from scipy.linalg import polar

N = 4
iterations = 10000
for i in range(iterations):
    A = np.random.randn(N, N)
    # A = A + A.T
    U, P = polar(A)
    are_equal = np.allclose(U @ P, P @ U)
    if not are_equal:
        print("Matrix A does not have commutative polar decomposition!")
        print("Value of A:")
        print(A)
        break
    if (i + 1) % (iterations // 10) == 0:
        print(f"Checked {i + 1} matrices, all had commutative polar decompositions")

If you run this, it will immediately find a counter-example, because the matrix is not symmetric. However, if you uncomment A = A + A.T, which forces the random matrix to be symmetric, then all of the matrices work.

Lastly, if you need a left-sided polar decomposition, you can use polar(A, side='left') to get that. The documentation explains how to do this.

Upvotes: 1

Related Questions