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

Details and Options

  • A p×q matrix m is unitary if pq and ConjugateTranspose[m].m is the q×q identity matrix, or pq and m.ConjugateTranspose[m] is the p×p identity matrix.
  • UnitaryMatrixQ works for symbolic as well as numerical matrices.
  • The following options can be given:
  • NormalizedTruetest if matrix rows are normalized
    SameTestAutomaticfunction to test equality of expressions
    ToleranceAutomatictolerance for approximate numbers
  • For exact and symbolic matrices, the option SameTest->f indicates that two entries aij and bij are taken to be equal if f[aij,bij] gives True.
  • For approximate matrices, the option Tolerance->t can be used to indicate that the norm γ=m.m-In satisfying γt is taken to be zero where In is the identity matrix.


open allclose all

Basic Examples  (1)

Test if a matrix is unitary:

Scope  (4)

A real matrix:

A complex matrix:

A dense matrix:

A sparse matrix:

An approximate MachinePrecision matrix:

An approximate arbitrary-precision matrix:

A matrix with symbolic entries:

The matrix becomes unitary when c=TemplateBox[{b}, Conjugate] and d=-TemplateBox[{a}, Conjugate]:

Generalizations & Extensions  (1)

A matrix can be rectangular:

In this case, matrix rows can be checked to see if they are orthonormal:

A matrix can have more rows than columns:

The columns of the matrix m are orthonormal:

Options  (3)

Normalized  (1)

Symbolic unitary matrix rows are often not normalized to 1:

We can avoid testing if the rows or columns are normalized:

SameTest  (1)

This matrix is unitary for a positive real , but UnitaryMatrixQ gives False:

Use the option SameTest to get the correct answer:

Tolerance  (1)

Generate an orthogonal real-valued matrix with some random perturbation of order 10-14:

q.q is not exactly zero outside the main diagonal:

Adjust the option Tolerance for accepting the matrix as unitary:

Tolerance is applied to the following value:

Applications  (5)

Unitary matrices play an important role in some matrix decompositions:

The inverse of a unitary matrix is unitary:

The inverse of a unitary matrix can be replaced by its conjugate transpose:

Orthogonalize applied to complex vectors generates a unitary matrix:

The matrix does not need to be square:

The matrix p=IdentityMatrix[n]-(2 v.TemplateBox[{v}, ConjugateTranspose])/(v^.v) is always unitary for any nonzero vector :

It is called a Householder reflection and is used to set to zero selected components of a given column vector :

Check that a matrix drawn from CircularUnitaryMatrixDistribution is unitary:

Check that matrices drawn from CircularOrthogonalMatrixDistribution and CircularSymplecticMatrixDistribution are also unitary:

Properties & Relations  (10)

A matrix is unitary if m.ConjugateTranspose[m]IdentityMatrix[n]:

For an approximate matrix, the identity is approximately true:

Any real-valued orthogonal matrix is unitary:

But a complex unitary matrix is typically not orthogonal:

Dot products of unitary matrices are unitary:

For some matrix functions, a unitary matrix argument gives a unitary matrix:

A unitary matrix is normal:

A unitary matrix has a full set of linear independent eigenvectors:

All eigenvalues of a unitary matrix have the absolute value equal to 1:

The singular values are all 1 for a unitary matrix:

The absolute value of the determinant of a unitary matrix is 1:

The 2-norm of a unitary matrix is always 1:

The matrix exponential MatrixExp of an antihermitian matrix is always unitary:

Wolfram Research (2014), UnitaryMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/UnitaryMatrixQ.html.


Wolfram Research (2014), UnitaryMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/UnitaryMatrixQ.html.


@misc{reference.wolfram_2021_unitarymatrixq, author="Wolfram Research", title="{UnitaryMatrixQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/UnitaryMatrixQ.html}", note=[Accessed: 23-September-2021 ]}


@online{reference.wolfram_2021_unitarymatrixq, organization={Wolfram Research}, title={UnitaryMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/UnitaryMatrixQ.html}, note=[Accessed: 23-September-2021 ]}


Wolfram Language. 2014. "UnitaryMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UnitaryMatrixQ.html.


Wolfram Language. (2014). UnitaryMatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UnitaryMatrixQ.html