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:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

This matrix is rectangular:

In[1]:=
Click for copyable input
Out[1]=

These are not matrices:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Applications  (1)

Properties & Relations  (1)

See Also

MatrixQ  HermitianMatrixQ  VectorQ  Dimensions  SquareRepeatingElement

Tutorials

Introduced in 2014
(10.0)