# Phase choice for Singular Value Decomposition

I'm using SingularValueDecomposition to find the unitary matrices that diagonalize a given matrix (that I have). This decomposition is unique, up to multiplication for an arbitrary phase of each column of the left and right unitary matrices. Is there a way to find out how Mathematica chooses this phase, or can I set some condition when using SingularValueDecomposition, for example, to impose that the first column of the left matrix must be real?

I can tell just from experiments: Apparently, the first row of U is always real:

n = 12;
A = RandomComplex[{-1 - I, 1 + I}, {n, n}];
{U, S, V} = SingularValueDecomposition[A];
Im[U[[1]]]


{0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}

As AccidentalFourierTransform pointed out, that means that each left singular value of A is normalized to have its first entry being real.

You can also achieve that the first row of V (hence the first entry of each right singular vector) is real by apply the following unitary transformation W:

W = DiagonalMatrix[Exp[-I Arg[V[[1, All]]]]];
Unew = U.W;
Vnew = V.W;
Max@Abs[Unew.S.ConjugateTranspose[Vnew] - A]
Chop[Im[Vnew[[1]]]]


1.9004*10^-15

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Analogously, you can manage to have only real numbers for either all the $$i$$-th entries of the left singular vectors or all the $$j$$-th entries of each the right singular vectors.

What probably puzzles you is that Mathematica uses the convention

U.S.ConjugateTranspose[V] == A


ConjugateTranspose[U].S.V == A

the latter being prefered in many textbooks because the column vectors of U and V are then the singular vectors.