Matrices are an important tool in algebra. A matrix nicely represents a homomorphism between two vector spaces with respect to a choice of bases for the vector spaces. Also matrices represent systems of linear equations.

In **GAP** matrices are represented by list of vectors (see
Vectors). The vectors must all have the same length, and their elements must
lie in a common field. The field may be the field of rationals (see
Rationals), a cyclotomic field (see Cyclotomics), a finite field (see
Finite Fields), or a library and/or user defined field (or ring) such as a
polynomial ring (see Polynomials).

The first section in this chapter describes the operations applicable to matrices (see Operations for Matrices). The next sections describes the function that tests whether an object is a matrix (see IsMat). The next sections describe the functions that create certain matrices (see IdentityMat, NullMat, TransposedMat, and KroneckerProduct). The next sections describe functions that compute certain characteristic values of matrices (see DimensionsMat, TraceMat, DeterminantMat, RankMat, and OrderMat). The next sections describe the functions that are related to the interpretation of a matrix as a system of linear equations (see TriangulizeMat, BaseMat, NullspaceMat, and SolutionMat). The last two sections describe the functions that diagonalize an integer matrix (see DiagonalizeMat and ElementaryDivisorsMat).

Because matrices are just a special case of lists, all operations and functions for lists are applicable to matrices also (see chapter Lists). This especially includes accessing elements of a matrix (see List Elements), changing elements of a matrix (see List Assignment), and comparing matrices (see Comparisons of Lists).

This chapter contains the following sections:

- 34.1. Operations for Matrices
- 34.2. IsMat
- 34.3. IdentityMat
- 34.4. NullMat
- 34.5. TransposedMat
- 34.6. KroneckerProduct
- 34.7. DimensionsMat
- 34.8. TraceMat
- 34.9. DeterminantMat
- 34.10. RankMat
- 34.11. OrderMat
- 34.12. TriangulizeMat
- 34.13. BaseMat
- 34.14. NullspaceMat
- 34.15. SolutionMat
- 34.16. DiagonalizeMat
- 34.17. ElementaryDivisorsMat
- 34.18. PrintArray