SquareMatrixQ

SquareMatrixQ[m]

gives True if m is a square matrix, and False otherwise.

Details

  • A matrix m is square if Dimensions[m]{n,n} has the same number of rows and columns.
  • SquareMatrixQ works for symbolic as well as numerical matrices.

Examples

open allclose all

Basic Examples  (3)

Test if an object is a square matrix:

This matrix is rectangular:

These are not matrices:

Applications  (1)

Define a function that only evaluates for explicit square matrices:

This represents the Hermitian part of a matrix explicitly:

This does not evaluate because the matrix is rectangular:

This does not evaluate because a is not an explicit matrix:

Properties & Relations  (1)

A square matrix is made up of vectors of length :

Introduced in 2014
 (10.0)