# How to find multiple groups of solutions that meet the requirements

I want to find multiple nonzero real matrices A, B that satisfy $$A.B=\mathbf{0}$$ condition.

A = Array[a, {3, 3}];
B = Array[b, {3, 3}];
FindInstance[
A.B == ConstantArray[0, {3, 3}] && A != ConstantArray[0, {3, 3}] &&
B != ConstantArray[0, {3, 3}], Flatten[{A, B}], Reals,5]
{{A, B}} /. First[%]


However, the above code can not return the desired results for a long time. What can I do to quickly get multiple sets of matrices that meet the requirements (their elements are preferably rational numbers)?

• Is there some reason to avoid using NullSpace? Commented Aug 19, 2020 at 15:39

{{{a,b,c},{d,e,f},{g,h,i}},{{j,k,l},{m,n,o},{p,q,r}}}/.

All the results I've seen have rational or integer entries. It does seem to tend towards solutions with one or more zero rows. If a zero row is acceptable then replacing a,b,c with 0,0,0 seems to speed it up significantly. Eliminating the Element[,Reals] speeds it up even more, but that results in a lot of Complex values.