The Hermite normal form of a matrix A with integer coefficients is a sort of integer row-echelon form. It is an upper triangular matrix B such that B=UA for a matrix U which is invertible in ℤ (det(U)=± 1). The ihermite command finds the Hermite normal form of a matrix.
The result is obtained by a Gauss-like reduction algorithm using only operations of rows with integer coefficients and invertible in ℤ.
Example.
Input:
Output:
⎡ ⎢ ⎢ ⎣ |
| ⎤ ⎥ ⎥ ⎦ | , | ⎡ ⎢ ⎢ ⎣ |
| ⎤ ⎥ ⎥ ⎦ |
Let M be a matrix with integer coefficients. To find the nullspace of M, you want find what you can multiply M by on the right to get the zero vector, but the Hermite command returns a matrix that you multiply on the left of M. So consider the transpose of M, MT.
Let A be the Hermite normal form of MT, and U an invertible matrix in ℤ such that A = U MT. Transposing this, you’ll get AT=M UT. Note that M times a column of UT equals the corresponding column of AT. So if a column of AT is the zero vector, then M times the corresponding column of UT will be the zero vector. In fact, these columns of UT will be a ℤ-basis for the nullspace of M.
Any columns of AT which are all 0s correspond to the rows of A which are all 0s. Since A is in Hermite form, these will be at the bottom, and so the corresponding rows of U will be at the bottom, and will be a ℤ-basis for the nullspace of M.
As an example, consider the matrix M:
Input:
Find the Hermite decomposition:
Input:
Output:
⎡ ⎢ ⎢ ⎣ |
| ⎤ ⎥ ⎥ ⎦ | , | ⎡ ⎢ ⎢ ⎣ |
| ⎤ ⎥ ⎥ ⎦ |
Only the third row of A consists of all 0s, so a ℤ-basis for the nullspace of M consists of only the third row of U; namely U[2]=[-1,2,-1].
You can check that this is in the nullspace:
Input:
Output:
⎡ ⎣ | 0,0,0 | ⎤ ⎦ |