SquareMatrixQ

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

DetailsDetails

  • 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.

ExamplesExamplesopen allclose all

Basic Examples  (3)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]=
Introduced in 2014
(10.0)