# Orthogonality by Singular value decomposition "svd"

5 views (last 30 days)
M on 27 Jan 2023
Edited: John D'Errico on 27 Jan 2023
How to use the Singular value decomposition "svd" to perform the Orthogonalization between vectors?
Torsten on 27 Jan 2023
Moved: John D'Errico on 27 Jan 2023
Never heard of this method. According to the literature link, it seems to be strongly coupled with a physics application. So I suggest you read the article referenced if you think it might be of help for your application, too.
Löwdin, Per-Olov (1970). "On the nonorthogonality problem". Advances in quantum chemistry. Vol. 5. Elsevier. pp. 185–199.

John D'Errico on 27 Jan 2023
Seems easy enough.
A = randi(5,[5,3])
A = 5×3
3 1 2 1 2 3 2 4 5 4 5 2 2 2 5
rank(A)
ans = 3
So A is a simple matrix, with rank 3. There are 3 vectors that would form a basis for the column space of A.
Using the SVD, can we find such a set of vectors? Yes.
[U,S,V] = svd(A,0);
U
U = 5×3
-0.2851 0.1392 0.8395 -0.3135 -0.2300 -0.1791 -0.5693 -0.2524 -0.4040 -0.5261 0.7822 -0.1560 -0.4687 -0.5022 0.2749
The matrix U is exactly what you want. The vectors are orthonormal (so both orthogonal and having unit norm.)
U'*U
ans = 3×3
1.0000 -0.0000 -0.0000 -0.0000 1.0000 -0.0000 -0.0000 -0.0000 1.0000
We get an identity matrix. (To within floating point trash. the -0.0000 elements are all essentially on the order of +/- eps.)
And U has the property that they span the column space of A. So ANY of the columns of A can be represented as some linear combination of the columns of U. The SVD essentially provides the transformation to orthogonality you seem to be asking to get. If you want, it has orthognalized the columns of A.
##### 2 CommentsShowHide 1 older comment
John D'Errico on 27 Jan 2023
Edited: John D'Errico on 27 Jan 2023
What does it mean to have a matrix orthogonalized with a vector? I'm sorry, but that statement makes little mathematical sense. As well, what are you talking about in terms of an orthogonalization test?
If you want better help, then you need to ask meaningful questions. Sorry, but true. It seems as if you are throwing around a lot of jargon that you don't really understand. Perhaps this is what you are asking:
X = 1:5;
Xnull = null(X)
Xnull = 5×4
-0.2697 -0.4045 -0.5394 -0.6742 0.9359 -0.0961 -0.1282 -0.1602 -0.0961 0.8558 -0.1923 -0.2403 -0.1282 -0.1923 0.7437 -0.3204 -0.1602 -0.2403 -0.3204 0.5995
V is a vector. And the matrix Vnull is a set of vectors that span the nullspace of V. Two vectors ar e orthogonal if their dot product is zero. Is that the test you were asking about?
X*Xnull
ans = 1×4
1.0e-15 * 0.4441 0.4441 0.8882 0.8882
As you should see, the dot products of X with each of the vectors in Xnull are zero, to within floating point trash.
Xnull'*Xnull
ans = 4×4
1.0000 -0.0000 -0.0000 -0.0000 -0.0000 1.0000 -0.0000 -0.0000 -0.0000 -0.0000 1.0000 -0.0000 -0.0000 -0.0000 -0.0000 1.0000
As well, you should see this is the 4x4 identity matrix, so we see that Xnull is indeed a set of orthonormal vectors.
I used NULL to do the work. But if you look carefully at the code for NULL (it is not built-in), you would see it just calls SVD. I could also have done this:
[U,S,V] = svd(X');
Now the set of nullspace vectors are just given as
U(:,2:end)
ans = 5×4
-0.2697 -0.4045 -0.5394 -0.6742 0.9359 -0.0961 -0.1282 -0.1602 -0.0961 0.8558 -0.1923 -0.2403 -0.1282 -0.1923 0.7437 -0.3204 -0.1602 -0.2403 -0.3204 0.5995
As you can see, this is what null returns. And null just uses SVD anyway. So just use null, if that is what you need.
I'm only making random guesses here, since I have no idea what you are really asking.