Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am trying to solve a set of equations like the following one using singular value decomposition:

3x + 5y = 11
x + y = 3
x + 2y = 4
x - y = 1

This is a trivial example, of course; the reason why I'm trying to do this at all is that I want to apply it to working with measured data containing noise, and I was hoping that including redundancies would make the system more stable (without those redundancies a certain noise level kills the approach, but up to that point it works fine).

From what I have read about SVD it should be able to handle cases like the one above, yet when I try it (using the Fortran code given here, pp. 51), even in the absence of simulated noise, it gives me (seemingly?) nonsensical results (x = 0.59 and y = -0.66 for my example set). Several times I have checked my code for errors, but to no avail, so currently I'm wondering whether I simply cannot feed those redundancies to SVD and expect to get a meaningful result. Or can I?

I am not a mathematician, so currently I'm feeling somewhat lost. It would be great if someone on here could help me out and tell me whether the chosen approach has been doomed from the start. Thanks a lot in advance!

share|improve this question
Did you remember to set the "tiny" (depending on your criterion for "tiny", of course) singular values you get in your system to zero before computing the pseudoinverse? –  J. M. May 2 '12 at 12:35
@J.M. I'm doing that, yes. However, for the trivial example above the singular values are all much larger than what would be classified as 'tiny'. Do you this might be the problem? –  canavanin May 2 '12 at 12:52
Neither $6.40112$ nor $1.42326$ would be usually considered "tiny", indeed. I am getting the least squares solution $(2,1)^\top$ from your system; how did you get your answer? –  J. M. May 2 '12 at 13:01
@J.M. I get the singular values you mention, yet the final result is different. I use the routine given on p. 56 of the link from my question to compute it, which works fine if I use two equations only. Maybe there really is something wrong with my own code at some point. Must check again! What did you use to perform the calculation? And, by the way, thanks a lot for your help! –  canavanin May 2 '12 at 13:09
@J.M. Thank you so much! I have finally, after a couple of days, found the error (something to do with array indices). What a relief :) Thank you very much for your time and effort. –  canavanin May 2 '12 at 13:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.