0
$\begingroup$

I am trying to generate 500 matrices whose null spaces are non-zero, integer vectors.

I currently generate the matrices by using rand() to choose a number between 1 and 5. I find the kernel by passing the matrix to EigenLib's kernel() function. However, my matrix generation algorithm is entirely insufficient because (generally) 19/20 of the kernels are the zero vector.

How do I generate matrices whose null spaces will have integer, non-zero vectors?

$\endgroup$
  • $\begingroup$ Should the null spaces have a specific dimension? $\endgroup$ – Rodrigo de Azevedo Jul 17 '17 at 17:28
0
$\begingroup$

First choose a column vector $v$ with integer entries that is to be in the null space. Then find a matrix whose rows are orthogonal to $v$. The simplest case will be if some element $v_k$ of $v$ is $\pm 1$. Then you can choose the entries $a_{ij}$ for $j \ne k$ randomly, and take $a_{ik} = \mp \sum_{j \ne k} a_{ij} v_j$.

$\endgroup$
  • $\begingroup$ Just trying to understand...a matrix, M, orthogonal to v, will mean that M x v = 0. What is the difference between aij and aik in your example? $\endgroup$ – maddie Jul 17 '17 at 17:45
  • $\begingroup$ $a_{ik}$ is the element that will multiply $v_k$, which is $\pm 1$. $\endgroup$ – Robert Israel Jul 17 '17 at 19:49
  • $\begingroup$ For example, if your matrices are $3 \times 3$ and $v = \pmatrix{3\cr 2\cr 1\cr}$, you take $a_{i3} = - 3 a_{i1} - 2 a_{i2}$, where $a_{i1}$ and $a_{i2}$ are any integers. $\endgroup$ – Robert Israel Jul 17 '17 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.