Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is benefit to use SVD for solving Ax=b

I have a linear equation such as

Ax=b

where A is full rank matrix which its size is 512x512. b is a vector of 512x1. x is unknown vector. I want to find x, hence, I have some options for doing that

1.Using the normal way

inv(A)*b

2.Using SVD ( Singular value decomposition)

[U S V]=svd(A);

x = V*(diag(diag(S).^-1)*(U.'*b))

Both methods give the same result. So, what is benefit of using SVD to solve Ax=b, especially in the case A is a 2D matrix?

like image 621
Jame Avatar asked Sep 22 '15 08:09

Jame


People also ask

What is the advantage of SVD?

The singular value decomposition (SVD) Pros: Simplifies data, removes noise, may improve algorithm results. Cons: Transformed data may be difficult to understand. Works with: Numeric values. We can use the SVD to represent our original data set with a much smaller data set.

What is SVD used for?

Singular Value Decomposition (SVD) is a widely used technique to decompose a matrix into several component matrices, exposing many of the useful and interesting properties of the original matrix.

Under what conditions can one apply eigendecomposition What about SVD?

The SVD always exists for any sort of rectangular or square matrix, whereas the eigendecomposition can only exists for square matrices, and even among square matrices sometimes it doesn't exist.

Why are singular values important?

In addition to what you describe in your question, positive singular values can be used to determine the effective rank of a matrix A by counting small values as zeros. That is often done when computing the SVD numerically.


2 Answers

Welcome to the world of numerical methods, let me be your guide.

You, as a new person in this world wonders, "Why would I do something this difficult with this SVD stuff instead of the so commonly known inverse?! Im going to try it in Matlab!"

And no answer was found. That is, because you are not looking at the problem itself! The problems arise when you have an ill-conditioned matrix. Then the computing of the inverse is not possible numerically.

example:

A=[1    1  -1;
   1   -2   3;
   2   -1   2];

try to invert this matrix using inv(A). Youll get infinite. That is, because the condition number of the matrix is very high (cond(A)).

However, if you try to solve it using SVD method (b=[1;-2;3]) you will get a result. This is still a hot research topic. Solving Ax=b systems with ill condition numbers.

As @Stewie Griffin suggested, the best way to go is mldivide, as it does a couple of things behind it.

(yeah, my example is not very good because the only solution of X is INF, but there is a way better example in this youtube video)

like image 104
Ander Biguri Avatar answered Oct 17 '22 18:10

Ander Biguri


inv(A)*b has several negative sides. The main one is that it explicitly calculates the inverse of A, which is both time demanding, and may result in inaccuracies if values vary by many orders of magnitude.

Although it might be better than inv(A)*b, using svd is not the "correct" approach here. The MATLAB-way to do this is using mldivide, \. Using this, MATLAB chooses the best algorithm to solve the linear system based on its properties (Hermation, upper Hessenberg, real and positive diagonal, symmetric, diagonal, sparse etc.). Often, the solution will be a LU-triangulation with partial permutation, but it varies. You'll have a hard time beating MATLABs implementation of mldivide, but using svd might give you some more insight of the properties of the system if you actually investigates U, S, V. If you don't want to do that, do with mldivide.

like image 30
Stewie Griffin Avatar answered Oct 17 '22 20:10

Stewie Griffin