---
title: "Predicates"
canonical: "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/Matrices/predicates.html"
source: "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/Matrices/predicates.md"
part: "Matrices and Linear Algebra"
chapter: "Matrices"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Matrices and Linear Algebra", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/index-matrices-linear-algebra.md"}
  - {"title": "Matrices", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/Matrices/index-matrices.md"}
prev: {"title": "Nullspaces and Solutions of Systems", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/Matrices/solution-equation.md"}
next: {"title": "Determinant and Other Properties", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/Matrices/properties.md"}
intrinsics:
  - {"name": "IsZero", "signature": "IsZero(A): Mtrx -> BoolElt"}
  - {"name": "IsOne", "signature": "IsOne(A): Mtrx -> BoolElt"}
  - {"name": "IsMinusOne", "signature": "IsMinusOne(A): Mtrx -> BoolElt"}
  - {"name": "IsScalar", "signature": "IsScalar(A): Mtrx -> BoolElt"}
  - {"name": "IsDiagonal", "signature": "IsDiagonal(A): Mtrx -> BoolElt"}
  - {"name": "IsSymmetric", "signature": "IsSymmetric(A): Mtrx -> BoolElt"}
  - {"name": "IsHermitian", "signature": "IsHermitian(A, f): Mtrx, Map -> BoolElt"}
  - {"name": "IsUpperTriangular", "signature": "IsUpperTriangular(A): Mtrx -> BoolElt"}
  - {"name": "IsLowerTriangular", "signature": "IsLowerTriangular(A): Mtrx -> BoolElt"}
  - {"name": "IsUnit", "signature": "IsUnit(A): Mtrx -> BoolElt"}
  - {"name": "IsSingular", "signature": "IsSingular(A): Mtrx -> BoolElt"}
  - {"name": "IsSymplecticMatrix", "signature": "IsSymplecticMatrix(A): Mtrx -> BoolElt"}
---

# Predicates

The functions in this section test various properties of matrices. See also the Lattices chapter for a description of the function [`IsPositiveDefinite`](https://docs.magma-maths.org/v2.30-1/LatticesQuadraticForms/Lattices/definite.md#function-lat-ispositivedefinite) and related functions.

<a id="function-iszero-mtrx"></a>
## `IsZero(A): Mtrx -> BoolElt`

Given an $m \times n$ matrix $A$ over the ring $R$, return `true` iff $A$ is the $m \times n$ zero matrix.

<a id="function-isone-mtrx"></a>
## `IsOne(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is the $m \times m$ identity matrix.

<a id="function-isminusone-mtrx"></a>
## `IsMinusOne(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is the negation of the $m \times m$ identity matrix.

<a id="function-isscalar-mtrx"></a>
## `IsScalar(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is scalar, i.e., iff $A$ is the product of some element of $R$ and the $m \times m$ identity matrix.

<a id="function-isdiagonal-mtrx"></a>
## `IsDiagonal(A): Mtrx -> BoolElt`

Given a square matrix $A$ over the ring $R$, return `true` iff $A$ is diagonal, i.e., iff the only non-zero entries of $A$ are on the diagonal.

<a id="function-issymmetric-mtrx"></a>
## `IsSymmetric(A): Mtrx -> BoolElt`

Given a square matrix $A$ over the ring $R$, return `true` iff $A$ is symmetric, i.e., iff $A$ equals its transpose.

<a id="function-ishermitian-mtrx-map"></a>
## `IsHermitian(A, f): Mtrx, Map -> BoolElt`

Given a square matrix $A$ over the ring $R$, and an involution $f : R \to R$, return `true` iff $A$ is Hermitian with respect to $f$, i.e., iff $A$ equals applying $f$ to its transpose.

<a id="function-isuppertriangular-mtrx"></a>
## `IsUpperTriangular(A): Mtrx -> BoolElt`

Given a matrix $A$ over the ring $R$, return `true` iff $A$ is upper triangular, i.e., iff the only non-zero entries of $A$ are on or above the diagonal.

<a id="function-islowertriangular-mtrx"></a>
## `IsLowerTriangular(A): Mtrx -> BoolElt`

Given a matrix $A$ over the ring $R$, return `true` iff $A$ is lower triangular, i.e., iff the only non-zero entries of $A$ are on or below the diagonal.

<a id="function-isunit-mtrx"></a>
## `IsUnit(A): Mtrx -> BoolElt`

Given a square matrix $A$ over the ring $R$, return `true` iff $A$ is a unit, i.e., iff $A$ has an inverse. The coefficient ring $R$ may be any commutative ring (since the computation depends on testing if the determinant is a unit – a calculation which is supported in all commutative rings).

<a id="function-issingular-mtrx"></a>
## `IsSingular(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is singular, i.e., iff the determinant of $A$ is zero (or, equivalently, iff the rank of $A$ is less than $m$). Note that `(not IsSingular(A))` is *not* equivalent to `IsUnit(A)` whenever $R$ is not a field: if the determinant of $A$ is non-zero but not a unit, then $A$ is non-singular but not invertible. The coefficient ring $R$ may be any commutative ring (since the computation involves only computing the determinant and testing whether it is zero).

<a id="function-issymplecticmatrix-mtrx"></a>
## `IsSymplecticMatrix(A): Mtrx -> BoolElt`

Given an $m \times m$ matrix $A$ over the integers, return `true` if and only if $A$ is an integer symplectic matrix, that is, $AJ{}^tA = J$, where $J = \left(\begin{matrix}0 & {\bf 1}_g \\ -{\bf 1}_g & 0\end{matrix}\right).$
