Tool for calculating the Hermite normal form (by reducing a matrix to its row echelon form) from a matrix M (with coefficients in Z) the computation yields 2 matrices H and U such that $ H = U . M $.
Hermite Normal Form Matrix - dCode
Tag(s) : Matrix
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The Hermite Normal Form (HNF) of an integer matrix is a canonical form obtained via unimodular transformations.
In the row version, a matrix $ H $ is in Hermite Normal Form if:
— $ H $ is in row echelon form (each pivot is strictly to the right of the pivot in the previous row)
— the pivots are strictly positive
— the coefficients above each pivot satisfy $ 0 \leq H_{i,j} < H_{k,j} $ where $ H_{k,j} $ is the pivot of the column
— any zero rows are at the bottom
This form is unique for a given matrix.
There are two conventions to define the Hermite Normal Form:
— row form: there exists a unimodular matrix $ U $ such that $ U M = H $
— column form: there exists a unimodular matrix $ U $ such that $ M U = H $
In both cases, $ H $ satisfies echelon and reduction properties. The difference lies in whether the operations are applied to rows or to columns.
For an integer matrix $ M $, there exists a unimodular matrix $ U $ such that: $ U M = H $.
The computation consists of applying elementary row operations (swaps, additions, integer linear combinations) to obtain an echelon matrix satisfying the constraints of the Hermite Normal Form.
These operations rely in particular on the extended Euclidean algorithm to eliminate coefficients below the pivots while staying within the integers.
Manual computation is possible for small matrices, but specialized algorithms are used in practice for larger matrices.
Example: $$ M = \begin{bmatrix} 3 & 2 & 1 \\ 0 & 1 & 0 \\ 1 & 1 & 1 \end{bmatrix} \Rightarrow U = \begin{bmatrix} 0 & -1 & 1 \\ 0 & 1 & 0 \\ -1 & -1 & 3 \end{bmatrix}, H = \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 2 \end{bmatrix} $$
dCode uses the LLL algorithm (Lenstra–Lenstra–Lovász) to compute the Hermite decomposition
Yes, the Hermite Normal Form is unique for a given integer matrix, provided that the chosen convention (row form or column form) is fixed.
The constraints on pivots and coefficients ensure this uniqueness.
The classical row echelon form is defined over real numbers and allows arbitrary divisions. It is not unique.
The Hermite Normal Form is defined for matrices with integer coefficients and requires computations to remain within integers.
It adds extra constraints (positive pivots, reduction modulo pivots), which guarantees a unique form.
dCode retains ownership of the "Hermite Normal Form Matrix" source code. Any algorithm for the "Hermite Normal Form Matrix" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Hermite Normal Form Matrix" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Hermite Normal Form Matrix" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Hermite Normal Form Matrix" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Hermite Normal Form Matrix on dCode.fr [online website], retrieved on 2026-04-30,