Finding a basis for a free module

72 Views Asked by At

Let q $\in$ $\Bbb Q^3$, such that the elements of q are positive numbers. Let M $\subset \Bbb Z^3$ be defined as

$\hspace{3in}$M = $\{ \mathbf n \in \Bbb Z^3 | \mathbf n \cdot \mathbf q \in \Bbb Z \}$,

where $\cdot$ denotes the usual vector dot product.

It is easy to see that M is a free $\Bbb Z$-module and my task is to find a basis for it. What I have so far is that if $\mathbf q = \left( \frac{k_1}{m_1}, \frac{k_2}{m_2}, \frac{k_3}{m_3}\right)$, where $k_i, m_i \in \Bbb Z$, then $\{ \left( m_1, 0, 0\right), \left( 0, m_2, 0\right), \left( 0, 0, m_3\right) \}$ is a set of linearly independent elements of M. However, this is not a basis of M in general (just see the case $\mathbf q = \left( \frac{1}{2}, \frac{1}{2}, \frac{1}{2}\right)$), but I believe that if $\mathbf n = \left( n_1, n_2, n_3 \right)$ is an element of such a basis, then $n_i \leq m_i$, for $i = 1,2,3$.

I am fairly new to the study of modules and I have been trying to find a theorem or anything that could help me, but people with more experience may know better. In fact, I don't really need a general solution but just a good enough algorithm for small enough values of $m_i$. What I have been doing is that I generate the set $\{ (n_1, n_2, n_3) | n_i \leq m_i \}$ by computing a cartesian product and then selecting the elements whose dot product with q results in an integer (not counting the zero vector). Then the three vectors with the smallest norm give me a basis for M, but this seems very inefficient. Maybe there is a smarter way to achieve this.