SymmetricMatrixQ
✖
SymmetricMatrixQ
Details and Options

- A matrix m is symmetric if m==Transpose[m].
- SymmetricMatrixQ works for symbolic as well as numerical matrices.
- The following options can be given:
-
SameTest Automatic function to test equality of expressions Tolerance Automatic tolerance for approximate numbers - For exact and symbolic matrices, the option SameTest->f indicates that two entries mij and mkl are taken to be equal if f[mij,mkl] gives True.
- For approximate matrices, the option Tolerance->t can be used to indicate that all entries Abs[mij]≤t are taken to be zero.
- For matrix entries Abs[mij]>t, equality comparison is done except for the last
bits, where
is $MachineEpsilon for MachinePrecision matrices and
for matrices of Precision
.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (10)Survey of the scope of standard use cases
Basic Uses (6)
Test if a real machine-precision matrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-c1lz7v

https://wolfram.com/xid/0d6dlp3lb3-u5nvc8

A real symmetric matrix is also Hermitian:

https://wolfram.com/xid/0d6dlp3lb3-be7x8u

Test if a complex matrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-vd1q50

https://wolfram.com/xid/0d6dlp3lb3-evd1wm

A complex symmetric matrix has symmetric real and imaginary parts:

https://wolfram.com/xid/0d6dlp3lb3-cfj13l

Test if an exact matrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-fhbhm1

https://wolfram.com/xid/0d6dlp3lb3-joxfpi


https://wolfram.com/xid/0d6dlp3lb3-cnbo4m

Use SymmetricMatrixQ with an arbitrary-precision matrix:

https://wolfram.com/xid/0d6dlp3lb3-h89ze5

A random matrix is typically not symmetric:

https://wolfram.com/xid/0d6dlp3lb3-e792ql

Use SymmetricMatrixQ with a symbolic matrix:

https://wolfram.com/xid/0d6dlp3lb3-p54id

The matrix becomes symmetric when :

https://wolfram.com/xid/0d6dlp3lb3-fz0wna

SymmetricMatrixQ works efficiently with large numerical matrices:

https://wolfram.com/xid/0d6dlp3lb3-bjhh1d

https://wolfram.com/xid/0d6dlp3lb3-n2hz99


https://wolfram.com/xid/0d6dlp3lb3-pcc5uf

Special Matrices (4)
Use SymmetricMatrixQ with sparse matrices:

https://wolfram.com/xid/0d6dlp3lb3-g2yb2


https://wolfram.com/xid/0d6dlp3lb3-dkghyq

Use SymmetricMatrixQ with structured matrices:

https://wolfram.com/xid/0d6dlp3lb3-f39gxg


https://wolfram.com/xid/0d6dlp3lb3-c0k3bb

Use with a QuantityArray structured matrix:

https://wolfram.com/xid/0d6dlp3lb3-so3bn


https://wolfram.com/xid/0d6dlp3lb3-d4v8l

The identity matrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-kkhgb9

HilbertMatrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-ou7ra

Options (2)Common values & functionality for each option
SameTest (1)
This matrix is symmetric for a positive real , but SymmetricMatrixQ gives False:

https://wolfram.com/xid/0d6dlp3lb3-em2aht

https://wolfram.com/xid/0d6dlp3lb3-ej0bsf

Use the option SameTest to get the correct answer:

https://wolfram.com/xid/0d6dlp3lb3-63zf1y

Tolerance (1)
Generate a real-valued symmetric matrix with some random perturbation of order 10-14:

https://wolfram.com/xid/0d6dlp3lb3-shf270

https://wolfram.com/xid/0d6dlp3lb3-bevb8i

Adjust the option Tolerance to accept this matrix as symmetric:

https://wolfram.com/xid/0d6dlp3lb3-5fapn2

The norm of the difference between the matrix and its transpose:

https://wolfram.com/xid/0d6dlp3lb3-cd27uf

Applications (13)Sample problems that can be solved with this function
Generating Symmetric Matrices (4)
Any matrix generated from a symmetric function is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-dvanq2

https://wolfram.com/xid/0d6dlp3lb3-fr35le

Using Table generates a symmetric matrix:

https://wolfram.com/xid/0d6dlp3lb3-e73hcz

SymmetrizedArray can generate matrices (and general arrays) with symmetries:

https://wolfram.com/xid/0d6dlp3lb3-qyltj4


https://wolfram.com/xid/0d6dlp3lb3-bxfo4l

Convert back to an ordinary matrix using Normal:

https://wolfram.com/xid/0d6dlp3lb3-x4r0b3

Check that matrices drawn from GaussianOrthogonalMatrixDistribution are symmetric:

https://wolfram.com/xid/0d6dlp3lb3-b8i9rt

Matrices drawn from CircularOrthogonalMatrixDistribution are symmetric and unitary:

https://wolfram.com/xid/0d6dlp3lb3-evoccp

Every Jordan matrix is similar to a symmetric matrix. Since any square matrix is similar to its Jordan form, this means that any square matrix is similar to a symmetric matrix. Define a function for generating an Jordan block for eigenvalue
:

https://wolfram.com/xid/0d6dlp3lb3-emcq7d
For example, here is the Jordan matrix of dimension 4 for the eigenvalue :

https://wolfram.com/xid/0d6dlp3lb3-vf9x6g

Define a function for generating a corresponding complex similarity transformation:

https://wolfram.com/xid/0d6dlp3lb3-1hkfxf
The matrix is a sum of times the identity matrix and
times the backward identity matrix:

https://wolfram.com/xid/0d6dlp3lb3-gj4alh

Then is symmetric, which shows that the Jordan matrix is similar to a symmetric matrix:

https://wolfram.com/xid/0d6dlp3lb3-w5xfly

Confirm the matrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-w1x2cg

Examples of Symmetric Matrices (5)
The Hessian matrix of a function is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-kskfqk

https://wolfram.com/xid/0d6dlp3lb3-hu2rz2


https://wolfram.com/xid/0d6dlp3lb3-osa25t

Many special matrices are symmetric, including FourierMatrix:

https://wolfram.com/xid/0d6dlp3lb3-ji4i66


https://wolfram.com/xid/0d6dlp3lb3-ltzqa5


https://wolfram.com/xid/0d6dlp3lb3-b0kry5

And HilbertMatrix:

https://wolfram.com/xid/0d6dlp3lb3-bgcub


https://wolfram.com/xid/0d6dlp3lb3-d6bzd3

Many filter kernel matrices are symmetric, including DiskMatrix:

https://wolfram.com/xid/0d6dlp3lb3-e3crdl


https://wolfram.com/xid/0d6dlp3lb3-hhv3t


https://wolfram.com/xid/0d6dlp3lb3-ekwb7g


https://wolfram.com/xid/0d6dlp3lb3-n0owqi

AdjacencyMatrix of an undirected graph is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-bv0dcf


https://wolfram.com/xid/0d6dlp3lb3-x5yw5r

As is KirchhoffMatrix:

https://wolfram.com/xid/0d6dlp3lb3-mozazl


https://wolfram.com/xid/0d6dlp3lb3-ztsm28

Visualize adjacency and Kirchhoff matrices for different graphs:

https://wolfram.com/xid/0d6dlp3lb3-0izfi

Several statistical measures are symmetric matrices, including Covariance:

https://wolfram.com/xid/0d6dlp3lb3-g93hx1

https://wolfram.com/xid/0d6dlp3lb3-bgvzb5


https://wolfram.com/xid/0d6dlp3lb3-wzxzm


https://wolfram.com/xid/0d6dlp3lb3-grp31s

Uses of Symmetric Matrices (4)
A positive-definite, real symmetric matrix or metric defines an inner product by
:

https://wolfram.com/xid/0d6dlp3lb3-xs2xkr


https://wolfram.com/xid/0d6dlp3lb3-i29f9p
Verify that is in fact symmetric and positive definite:

https://wolfram.com/xid/0d6dlp3lb3-hlh693

Orthogonalize the standard basis of to find an orthonormal basis:

https://wolfram.com/xid/0d6dlp3lb3-9jtyba

Confirm that this basis is orthonormal with respect to the inner product :

https://wolfram.com/xid/0d6dlp3lb3-mkuz95

The moment of inertia tensor is the equivalent of mass for rotational motion. For example, kinetic energy is , with
taking the place of the mass
and angular velocity
taking the place of linear velocity
in the formula
.
can be represented by a positive-definite symmetric matrix. Compute the moment of inertia for a tetrahedron with endpoints at the origin and positive coordinate axes:

https://wolfram.com/xid/0d6dlp3lb3-v3vcks

Verify that the matrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-flo6z5

Compute the kinetic energy if its angular velocity is :

https://wolfram.com/xid/0d6dlp3lb3-roafy1

The kinetic energy is positive as long as is nonzero, showing the matrix was positive definite:

https://wolfram.com/xid/0d6dlp3lb3-oesjhx

Determine if a sparse matrix is structurally symmetric:

https://wolfram.com/xid/0d6dlp3lb3-thiqo


https://wolfram.com/xid/0d6dlp3lb3-di0ziq

But it is structurally symmetric:

https://wolfram.com/xid/0d6dlp3lb3-ntplyc

Use a different method for symmetric matrices, with failover to a general method:

https://wolfram.com/xid/0d6dlp3lb3-cwrw3t
Construct real-valued matrices for testing:

https://wolfram.com/xid/0d6dlp3lb3-bzxact
For a non-symmetric matrix m, the function myLS just uses Gaussian elimination:

https://wolfram.com/xid/0d6dlp3lb3-nrymt

For a symmetric indefinite matrix ms, try Cholesky and continue with Gaussian elimination:

https://wolfram.com/xid/0d6dlp3lb3-jlyoju

https://wolfram.com/xid/0d6dlp3lb3-n81f4

For a symmetric positive-definite matrix mpd, try Cholesky, which succeeds:

https://wolfram.com/xid/0d6dlp3lb3-b8l0ms

https://wolfram.com/xid/0d6dlp3lb3-4l38u9


https://wolfram.com/xid/0d6dlp3lb3-bvwz55

Properties & Relations (14)Properties of the function, and connections to other functions
SymmetricMatrixQ[x] trivially returns False for any x that is not a matrix:

https://wolfram.com/xid/0d6dlp3lb3-dqapjm

A matrix is symmetric if mTranspose[m]:

https://wolfram.com/xid/0d6dlp3lb3-1hq6q

https://wolfram.com/xid/0d6dlp3lb3-l6roya

A real-valued symmetric matrix is Hermitian:

https://wolfram.com/xid/0d6dlp3lb3-c69qw1

https://wolfram.com/xid/0d6dlp3lb3-lhf692

But a complex-valued symmetric matrix may not be:

https://wolfram.com/xid/0d6dlp3lb3-in0t7b

https://wolfram.com/xid/0d6dlp3lb3-mwta3y

Use Symmetrize to compute the symmetric part of a matrix:

https://wolfram.com/xid/0d6dlp3lb3-brvqok

https://wolfram.com/xid/0d6dlp3lb3-6nfuuv

This equals the average of m and Transpose[m]:

https://wolfram.com/xid/0d6dlp3lb3-7p8qam

Any matrix can be represented as the sum of its symmetric and antisymmetric parts:

https://wolfram.com/xid/0d6dlp3lb3-btttfc

https://wolfram.com/xid/0d6dlp3lb3-ioxqc

Use AntisymmetricMatrixQ to test whether a matrix is antisymmetric:

https://wolfram.com/xid/0d6dlp3lb3-otom5j

If is a symmetric matrix with real entries, then
is antihermitian:

https://wolfram.com/xid/0d6dlp3lb3-5guo83

https://wolfram.com/xid/0d6dlp3lb3-hqo6rz

MatrixExp[I m] for real symmetric m is unitary:

https://wolfram.com/xid/0d6dlp3lb3-m8xru

https://wolfram.com/xid/0d6dlp3lb3-bcyqur

A real-valued symmetric matrix is always a normal matrix:

https://wolfram.com/xid/0d6dlp3lb3-ibz4t6

https://wolfram.com/xid/0d6dlp3lb3-bmf0bo

A complex-valued symmetric matrix need not be normal:

https://wolfram.com/xid/0d6dlp3lb3-qz67pn

https://wolfram.com/xid/0d6dlp3lb3-eb23tl

Real-valued symmetric matrices have all real eigenvalues:

https://wolfram.com/xid/0d6dlp3lb3-emyf98

https://wolfram.com/xid/0d6dlp3lb3-gqjpoz

Use Eigenvalues to find eigenvalues:

https://wolfram.com/xid/0d6dlp3lb3-bx6amt

Note that a complex-valued symmetric matrix may have both real and complex eigenvalues:

https://wolfram.com/xid/0d6dlp3lb3-zm6f3b

CharacteristicPolynomial[m,x] for real symmetric m can be factored into linear terms:

https://wolfram.com/xid/0d6dlp3lb3-uetwl5

https://wolfram.com/xid/0d6dlp3lb3-2ncihd

Real-valued symmetric matrices have a complete set of eigenvectors:

https://wolfram.com/xid/0d6dlp3lb3-gas7tm

https://wolfram.com/xid/0d6dlp3lb3-fetnrq

As a consequence, they must be diagonalizable:

https://wolfram.com/xid/0d6dlp3lb3-74hwjf

Use Eigenvectors to find eigenvectors:

https://wolfram.com/xid/0d6dlp3lb3-edsq1a

Note that a complex-valued symmetric matrix need not have these properties:

https://wolfram.com/xid/0d6dlp3lb3-1nzk4l

https://wolfram.com/xid/0d6dlp3lb3-rl3j4s

The inverse of a symmetric matrix is symmetric:

https://wolfram.com/xid/0d6dlp3lb3-n8jjxz

https://wolfram.com/xid/0d6dlp3lb3-r8bkoa

Matrix functions of symmetric matrices are symmetric, including MatrixPower:

https://wolfram.com/xid/0d6dlp3lb3-x6n7b

https://wolfram.com/xid/0d6dlp3lb3-n1hh3t


https://wolfram.com/xid/0d6dlp3lb3-0cu58

And any univariate function representable using MatrixFunction:

https://wolfram.com/xid/0d6dlp3lb3-b794x3

SymmetricMatrix can be used to explicitly construct symmetric matrices:

https://wolfram.com/xid/0d6dlp3lb3-cr5xbx

These satisfy SymmetricMatrixQ:

https://wolfram.com/xid/0d6dlp3lb3-o0d3a

Possible Issues (1)Common pitfalls and unexpected behavior
SymmetricMatrixQ uses the definition for both real- and complex-valued matrices:

https://wolfram.com/xid/0d6dlp3lb3-dvg8va

https://wolfram.com/xid/0d6dlp3lb3-jnorqo

These complex matrices need not be normal or possess many properties of self-adjoint (real symmetric) matrices:

https://wolfram.com/xid/0d6dlp3lb3-j4rs3c

HermitianMatrixQ tests the condition for self-adjoint matrices:

https://wolfram.com/xid/0d6dlp3lb3-xdwwzp

Alternatively, test if the entries are real to restrict to real symmetric matrices:

https://wolfram.com/xid/0d6dlp3lb3-nql4v5

https://wolfram.com/xid/0d6dlp3lb3-vgzldd

Neat Examples (1)Surprising or curious use cases
Images of symmetric matrices including FourierMatrix:

https://wolfram.com/xid/0d6dlp3lb3-ej1zt

https://wolfram.com/xid/0d6dlp3lb3-e4anw5


https://wolfram.com/xid/0d6dlp3lb3-cjr8o5

Wolfram Research (2008), SymmetricMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html (updated 2014).
Text
Wolfram Research (2008), SymmetricMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html (updated 2014).
Wolfram Research (2008), SymmetricMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html (updated 2014).
CMS
Wolfram Language. 2008. "SymmetricMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html.
Wolfram Language. 2008. "SymmetricMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html.
APA
Wolfram Language. (2008). SymmetricMatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html
Wolfram Language. (2008). SymmetricMatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html
BibTeX
@misc{reference.wolfram_2025_symmetricmatrixq, author="Wolfram Research", title="{SymmetricMatrixQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html}", note=[Accessed: 10-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_symmetricmatrixq, organization={Wolfram Research}, title={SymmetricMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/SymmetricMatrixQ.html}, note=[Accessed: 10-July-2025
]}