## NullSpace[_, Method->"OneStepRowReduction"] is sometimes wrong; how can I work out when this happens?

6

Edit 2015: Has this been fixed yet?

(This is on MMA 7.0.1.0 on OS X)

I've just found a large matrix m for which NullSpace[m] and NullSpace[m, Method->"OneStepRowReduction"] give different answers (the first one is the correct answer).

I put the matrix up at pastebin as won't fit here!

What's going on? How might I guess ahead of time which arguments are going to break Method->"OneStepRowReduction"?

(Update; it seems the bug has got worse in 8, rather than better.)

@Mr.Wizard for me, versions 7.0.1 and 9.0.1 (Windows) both give an empty null space. It is possible that this was a Mac OS-specific numerical bug. – Oleksandr R. – 2015-07-30T00:04:05.923

@Oleksandr Thanks working to pin this down. – Mr.Wizard – 2015-07-30T00:05:08.310

On a side note, Mathematica 8 yields an empty list in both cases. I'm going to assume the bug has been fixed. – David – 2012-02-02T00:57:11.913

Could have been either of two bugs in "OneStepRowReduction" when algebraics are present. Both were fixed prior to version 8 release. – Daniel Lichtblau – 2012-02-02T14:47:07.803

No, I think this is a real problem --- and your answers indicate it's got worse in Mathematica 8, not better! The NullSpace should not be empty. Here's the result of RootReduce[NullSpace[m]]: {{Root[3 - 80 #1^2 + 9 #1^4 &, 1], Root[3 - 80 #1^2 + 9 #1^4 &, 4], Root[-3 + 4 #1^2 + 3 #1^4 &, 4], Root[3 - 32 #1^2 + 81 #1^4 &, 3], Root[1 - 38 #1 + 116 #1^2 - 90 #1^3 + 27 #1^4 &, 4], Root[1 + 38 #1 + 116 #1^2 + 90 #1^3 + 27 #1^4 &, 4], Root[-1 + 23 #1^2 + 27 #1^4 &, 3], 1}}, which you can verify really is in the kernel. – Scott Morrison – 2012-02-02T19:08:57.630

@DanielLichtblau, is there any reference for these bugs? I'd like to be able to ascertain which code running in 7 I can or cannot 'trust' (to the extend that trusting Mathematica is ever possible). – Scott Morrison – 2012-02-02T20:04:40.330

@Scott Morrison (1) No reference I'm aware of. (2) I verified that matrix.your_vector has a 97th component of around -10.8. So it's not a serious contender for a null vector. – Daniel Lichtblau – 2012-02-02T22:02:38.023

Thanks for looking into this Daniel. In MMA 7 RootReduce was verifying that m.v was exactly zero; so perhaps the problem is in RootReduce in either 7 or 8? I'll investigate further. – Scott Morrison – 2012-02-13T22:07:22.007

3

\$Version
(*  "10.4.1 for Mac OS X x86 (64-bit) (April 11, 2016)"  *)


Let m = <pastebin monster>.

ns1 = NullSpace[m];
ns2 = NullSpace[m, Method -> "OneStepRowReduction"];
diff = ns1 - ns2;


RootReduce[diff]
(*  {{0, 0, 0, 0, 0, 0, 0, 0}}  *)


So they're equivalent in V10.4.1.

Update: Checking correctness

After many minutes, this returns the zero vector:

m.First@ns1 // RootReduce


And these all return a rank of 7:

MatrixRank[m]
MatrixRank[N[m]]
MatrixRank[N[m, 32]]


Finally, Dimensions[m] yields {880, 8}, all of which confirms the answer is correct.

Does the output appear to be correct or could they both be wrong? – Mr.Wizard – 2016-07-20T21:43:38.297

1@Mr.Wizard It appears (numerically) to give a correct null space member and the matrix rank comes out to be 7 (for an 880 x 8 matrix), both on the exact matrix and on numericized matrices at various precisions. So yes, the output appears to be correct. (I'm waiting on m.First@ns1 // RootReduce, but I'm not sure it will finished any time soon, or that I will wait for it.) – Michael E2 – 2016-07-20T21:50:26.690

0

I tried this problem (fed the matrix into an object called m) with 10.3 on a Macbook pro running OS X 10.10.5 (Yosemite). Both methods yield an empty Nullspace, though onesteprowreduction took much longer. So it looks like it hasn't been fixed in 10.3 :(.

Another possibility remains. @scott-morrison - can you demonstrate that it really is in the kernel?

In[17]:= NullSpace[m]

Out[17]= {}

In[18]:= NullSpace[m, Method -> "OneStepRowReduction"]

Out[18]= {}

1This answer might be more appropriate as a comment. – bbgodfrey – 2016-07-20T21:23:35.500

True, but I lack the reputation to be able to comment on others' questions – Michael Neale – 2016-07-26T22:26:25.420