`linalg`::`hermiteForm`

Hermite normal form of a matrix

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

```linalg::hermiteForm(`A`, <var>, <All>)
```

Description

`linalg::hermiteForm(A)` returns the Hermite normal form of a nonsingular integer square matrix A. The Hermite normal form of a matrix is an upper-triangular matrix H, such that Hjj ≥ 0 and for j > i. If matrix A is not square or singular, `linalg::hermiteForm` simply returns an upper-triangular matrix.

If matrix `A` is not of the domain `Dom::Matrix`(`Dom::Integer`) then `linalg::hermiteForm` converts `A` into a matrix of this domain for intermediate computations. If this conversion fails, then `linalg::hermiteForm` issues an error message.

`linalg::hermiteForm(A, var)` returns the Hermite normal form of `A` assuming that the elements of `A` are univariate polynomials in the variable `var`. If `A` does not contain `var`, then `hermiteForm(A)` and `hermiteForm(A,var)` return different results.

`linalg::hermiteForm(A, <var>, All)` returns the list `[H, U]`, where `H` is the Hermite normal form of `A`, and `U` is a unimodular transformation matrix, such that `H = U*A`. You can use the `All` option with or without specifying the variable `var`.

Examples

Example 1

Create the following matrix of integers.

`A := matrix([[9, -36, 30], [-36, 192, -180], [30, -180, 180]])`

Find the Hermite normal form of this matrix.

`linalg::hermiteForm(A)`

Use the `All` option to find the corresponding transformation matrix.

`[H, U] := linalg::hermiteForm(A, All)`

Verify that `H = U*A`.

`H = U*A`

Example 2

Create the following matrix of polynomials.

```B := matrix([[-(x - 3)^2*(x - 2),(x - 3)*(x - 2)*(x - 4)], [(x - 3)*(x - 2)*(x - 4),-(x - 3)^2*(x - 4)] ])```

Find the Hermite normal form of this matrix.

`linalg::hermiteForm(B)`

Use the `All` option to find the corresponding transformation matrix.

`[H, U] := linalg::hermiteForm(B, All)`

Example 3

If a matrix does not contain a particular variable, and you call `linalg::hermiteForm` specifying that variable as the second argument, then the result differs from what you get without specifying that variable. For example, create a matrix that does not contain any variables.

`A := matrix([[9, -36, 30], [-36, 192, -180], [30, -180, 180]])`

Call `linalg::hermiteForm` specifying variable `x` as the second argument. In this case, `linalg::hermiteForm` assumes that the elements of `A` are univariate polynomials in `x`.

`linalg::hermiteForm(A, x)`

Call `linalg::hermiteForm` without specifying variables. In this case, `linalg::hermiteForm` treats `A` as a matrix of integers.

`linalg::hermiteForm(A)`

Parameters

 `A` An integer matrix of category `Cat::Matrix`

Options

 `All` Returns the list `[H, U]`, where `H` is the Hermite normal form of `A`, and `U` is a corresponding transformation matrix.

Return Values

Matrix of the same domain type as `A`. With the option `All`, `linalg::hermiteForm` returns the list `[H, U]`, where `H` is a matrix of the same domain type as `A`, and `U` is a corresponding transformation matrix.

Algorithms

If A is an n×n matrix with coefficients in then its Hermite normal form is an n×n matrix H = (hij), such that H = AU with .

The Hermite normal form H is unique if A is matrix of full row rank. The matrix U is not unique.

If A is a square matrix, then the product of the diagonal elements of its Hermite normal form is, up to the sign, the determinant of A.

Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos