# 35 Matrix Rings

A matrix ring is a ring of square matrices (see chapter Matrices). In GAP you can define matrix rings of matrices over each of the fields that GAP supports, i.e., the rationals, cyclotomic extensions of the rationals, and finite fields (see chapters Rationals, Cyclotomics, and Finite Fields).

You define a matrix ring in GAP by calling `Ring` (see Ring) passing the generating matrices as arguments.

```    gap> m1 := [ [ Z(3)^0, Z(3)^0,   Z(3) ],
>            [   Z(3), 0*Z(3),   Z(3) ],
>            [ 0*Z(3),   Z(3), 0*Z(3) ] ];;
gap> m2 := [ [   Z(3),   Z(3), Z(3)^0 ],
>            [   Z(3), 0*Z(3),   Z(3) ],
>            [ Z(3)^0, 0*Z(3),   Z(3) ] ];;
gap> m := Ring( m1, m2 );
Ring( [ [ Z(3)^0, Z(3)^0, Z(3) ], [ Z(3), 0*Z(3), Z(3) ],
[ 0*Z(3), Z(3), 0*Z(3) ] ],
[ [ Z(3), Z(3), Z(3)^0 ], [ Z(3), 0*Z(3), Z(3) ],
[ Z(3)^0, 0*Z(3), Z(3) ] ] )
gap> Size( m );
2187 ```

However, currently GAP can only compute with finite matrix rings with a multiplicative neutral element (a one). Also computations with large matrix rings are not done very efficiently. We hope to improve this situation in the future, but currently you should be careful not to try too large matrix rings.

Because matrix rings are just a special case of domains all the set theoretic functions such as `Size` and `Intersection` are applicable to Set Functions for Matrix Rings).

Also matrix rings are of course rings, so all ring functions such as `Units` and `IsIntegralRing` are applicable to matrix rings (see chapter Rings and Ring Functions for Matrix Rings).

Previous Up Next
Index

GAP 3.4.4
April 1997