I work with matrices that have integer entries (using exact arithmetic). I want the results of operations such as nullspace to also be vectors with strictly integer entries.

Until now, I have implemented a reduced rank form at low ranks (adapted from here). The use of the entire row reduction (by previous link) allows me to correctly get the row space and column space of a matrix with coefficients of & # 39; 39; integer also having integer coefficients. The connection of the null space to the **r ref** of a matrix is also well known (for example here). The question is how can I generate the null space using the low integer rref that I have (which is similar, there are only diagonal elements that are not necessarily necessary) $ 1 $). The use of the algorithm to generate nullspace from rref with low rref fails for example for the following matrix:

$$ A = pmatrix {5 & 3 & 7 \ 10 & 6 & 14 \ 8 & 3 & 1} $$

the **low rref** calculated is:

$$ rref (A) = pmatrix {1 & -3 & -19 \ 0 & 9 & 51 \ 0 & 0 & 0} $$

Using the algorithm to generate the null space from the above **r ref** failed.

For example, the output is:

$ pmatrix {19 \ – 51 \ 1} $

How can I change the algorithm to generate zero space from low rref?

Thank you!

PS This is for a mine library for integer calculations that also supports integer matrices. Therefore, I implement exact and fractional algorithms.