### 15.2.14 Smith normal form in ℤ

A matrix B is in Smith normal form if the only non-zero entries are on the diagonal (for non-square matrices, this simply means that bij=0 for i≠j) and bi,i divides bi+1,i+1. The elements bi,i are called invariant factors and are used to describe the structure of finite abelian groups.

For any matrix A with coefficients in ℤ, there exist matrices U and V, invertible in ℤ, such that B=U A V is in Smith normal form and has coefficients in ℤ. The ismith command finds the matrices U, B and V.

- ismith takes A, a matrix with coefficients in ℤ.
- ismith(A) returns a list [U,B,V] of three matrices such that B=UAV is in Smith normal form and U and V are invertible in ℤ.

#### Example

A:=[[9,-36,30],[-36,192,-180],[30,-180,180]]:; U,B,V:=ismith(A)

⎡ ⎢ ⎢ ⎣ |
−3 | 0 | 1
6 | 4 | 3
20 | 15 | 12
| ⎤ ⎥ ⎥ ⎦
| , |
⎡ ⎢ ⎢ ⎣ |
3 | 0 | 0
0 | 12 | 0
0 | 0 | 60
| ⎤ ⎥ ⎥ ⎦
| , |
⎡ ⎢ ⎢ ⎣ |
1 | 24 | −30
0 | 1 | 0
0 | 0 | 1
| ⎤ ⎥ ⎥ ⎦

The invariant factors are 3, 12 and 60.