# rationalNormalForm -- rational normal form of a matrix

## Synopsis

• Usage:
(B,P,Q) = rationalNormalForm A
(B,P) = rationalNormalForm(A,ChangeMatrix=>{true,false})
(B,Q) = rationalNormalForm(A,ChangeMatrix=>{false,true})
B = rationalNormalForm(A,ChangeMatrix=>{false,false})
• Inputs:
• A, , a square matrix with constant entries
• Optional inputs:
• ChangeMatrix => ..., default value {true, true}
• Outputs:
• B, , the rational normal form of A
• P, , invertible (left) change of basis matrix
• Q, , invertible (right) change of basis matrix

## Description

This function produces a matrix B in rational normal form, and invertible matrices P and Q such that P*Q = I and B = P*A*Q.
 i1 : R = ZZ/101[x] o1 = R o1 : PolynomialRing i2 : M = R^4 4 o2 = R o2 : R-module, free i3 : A = random(M,M) o3 = | 24 19 -8 -38 | | -36 19 -22 -16 | | -30 -10 -29 39 | | -29 -29 -24 21 | 4 4 o3 : Matrix R <--- R i4 : factor det(x*id_M - A) 2 2 o4 = (x + 39x - 10)(x + 27x - 27) o4 : Expression of class Product i5 : (B,P,Q) = rationalNormalForm A o5 = (| -27 1 0 0 |, | 15 -11 46 -1 |, | 50 13 7 -23 |) | 27 0 0 0 | | 12 -46 -47 39 | | -37 -24 -41 -18 | | 0 0 -39 1 | | -9 47 33 -2 | | 23 1 33 1 | | 0 0 10 0 | | 41 -40 22 50 | | -8 0 -47 0 | o5 : Sequence i6 : B - P*A*Q == 0 o6 = true i7 : P*Q - id_M == 0 o7 = true

## Ways to use rationalNormalForm :

• "rationalNormalForm(Matrix)"

## For the programmer

The object rationalNormalForm is .