WOLFRAM

gives True if m is an explicitly orthogonal matrix, and False otherwise.

Details and Options

  • A p×q matrix m is orthogonal if pq and Transpose[m].m is the q×q identity matrix, or pq and m.Transpose[m] is the p×p identity matrix.
  • OrthogonalMatrixQ works for symbolic as well as numerical matrices.
  • The following options can be given:
  • Normalized Truetest if matrix columns are normalized
    SameTest Automaticfunction to test equality of expressions
    Tolerance Automatictolerance 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.mT-In satisfying γt is taken to be zero where In is the identity matrix.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Test if a 2×2 numeric matrix is orthogonal:

Out[1]=1

Test if a 3×3 symbolic matrix is orthogonal:

Out[2]=2

Verify the condition TemplateBox[{m}, Transpose].m=I by hand:

Out[3]=3

Scope  (14)Survey of the scope of standard use cases

Basic Uses  (6)

Test if a real matrix is orthogonal:

Out[2]=2

A real orthogonal matrix is also unitary:

Out[3]=3

Test if a complex matrix is orthogonal:

Out[2]=2

This matrix satisfies TemplateBox[{m}, Transpose].m=I:

Out[3]=3

A complex-valued orthogonal matrix is not unitary:

Out[4]=4

Test if an exact matrix is orthogonal:

Out[2]=2

Make the matrix orthogonal:

Out[3]=3

Use OrthogonalMatrixQ with arbitrary-precision matrix:

Out[1]=1

A random matrix is typically not orthogonal:

Out[2]=2

Use OrthogonalMatrixQ with a symbolic matrix:

Out[1]=1

The matrix becomes orthogonal when and :

Out[2]=2

OrthogonalMatrixQ works efficiently with large numerical matrices:

Out[2]=2
Out[3]=3

Special Matrices  (4)

Use OrthogonalMatrixQ with sparse matrices:

Out[1]=1
Out[2]=2

Use OrthogonalMatrixQ with structured matrices:

Out[1]=1
Out[2]=2

The identity matrix is orthogonal:

Out[1]=1

HilbertMatrix is not orthogonal:

Out[1]=1

Rectangular Semi-orthogonal Matrices  (4)

Test if a rectangular matrix is semi-orthogonal:

Out[2]=2

As there are more columns than rows, this indicates that the rows are orthonormal:

Out[3]=3

The columns are not orthonormal:

Out[4]=4

Test a matrix with more rows than columns:

Out[2]=2

The columns of the matrix are orthonormal:

Out[3]=3

The rows are not orthonormal:

Out[4]=4

Generate a random orthogonal matrix:

Out[2]=2

Any subset of its rows forms a rectangular semi-orthogonal matrix:

Out[3]=3

As does any subset of its columns:

Out[4]=4

Rectangular identity matrices are semi-orthogonal:

Out[1]=1

Options  (4)Common values & functionality for each option

Normalized  (2)

Symbolic orthogonal matrix columns are often not normalized to 1:

Out[2]=2

Avoid testing if the columns are normalized:

Out[3]=3

Multiply the second column of an orthogonal matrix by 2:

Out[1]=1

OrthogonalMatrixQ with NormalizedFalse will still give True for m:

Out[2]=2

However, it will not give true for Transpose[m]:

Out[3]=3

This is because TemplateBox[{m}, Transpose].m is a diagonal matrix, but m.TemplateBox[{m}, Transpose] is not:

Out[4]=4

SameTest  (1)

This matrix is orthogonal for a positive real , but OrthogonalMatrixQ gives False:

Out[2]=2

Use the option SameTest to get the correct answer:

Out[3]=3

Tolerance  (1)

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

Out[2]=2

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

Adjust the option Tolerance for accepting the matrix as orthogonal:

Out[4]=4

Tolerance is applied to the following value:

Out[5]=5

Applications  (10)Sample problems that can be solved with this function

Sources of Orthogonal Matrices  (5)

Any orthonormal basis for TemplateBox[{}, Reals]^n forms an orthogonal matrix:

The basis is orthonormal:

Out[2]=2

Putting the basis vectors in rows of a matrix forms an orthogonal matrix:

Out[3]=3

Putting them in columns also gives an orthogonal matrix:

Out[4]=4

Orthogonalize applied to real, linearly independent vectors generates an orthogonal matrix:

Out[2]=2

The matrix does not need to be square, in which case the resulting matrix is semi-orthogonal:

Out[4]=4
Out[6]=6

But the starting matrix must have full rank:

Out[8]=8
Out[9]=9

Any rotation matrix is orthogonal:

Out[1]=1
Out[2]=2
Out[3]=3

Any permutation matrix is orthogonal:

Out[1]=1
Out[2]=2

Matrices drawn from CircularRealMatrixDistribution are orthogonal:

Out[1]=1

Uses of Orthogonal Matrices  (5)

Orthogonal matrices preserve the standard inner product on TemplateBox[{}, Reals]^n. In other words, if is orthogonal and and are vectors, then :

Out[3]=3

This means the angles between the vectors are unchanged:

Out[4]=4

Since the norm is derived from the inner product, norms are preserved as well:

Out[5]=5
Out[6]=6

Any orthogonal matrix represents a rotation and/or reflection. If the matrix has determinant , it is a pure rotation. If it the determinant is , the matrix includes a reflection. Consider the following matrix:

It is orthogonal and has determinant :

Out[2]=2

Thus, it is a pure rotation; the Cartesian unit vectors and maintain their relative positions:

Out[3]=3

The following matrix is orthogonal but has determinant :

Out[5]=5

Thus, it includes a reflection; the Cartesian unit vectors and reverse their relative positions:

Out[6]=6

Orthogonal matrices play an important role in many matrix decompositions:

Out[1]=1
Out[2]=2
Out[3]=3
Out[4]=4

The matrix is always orthogonal for any nonzero real vector :

Out[1]=1

is called a Householder reflection; as a reflection, its determinant is :

Out[2]=2

It represents a reflection through a plane perpendicular to , sending to :

Out[3]=3

Any vector perpendicular to is unchanged by :

Out[4]=4

In matrix computations, is used to set to zero selected components of a given column vector :

Out[6]=6

Find the function satisfying the following differential equation:

Represent the cross-product with by means of multiplication by the antisymmetric matrix :

Out[3]=3
Out[4]=4

Compute the exponential and use it to define a solution to the equation:

Out[5]=5

Verify that satisfies the differential equation and initial condition:

Out[6]=6

The matrix is orthogonal for all values of :

Out[7]=7

Thus, the orbit of the solution is at a constant distance from the origin, in this case a circle:

Out[8]=8

Properties & Relations  (14)Properties of the function, and connections to other functions

A matrix is orthogonal if m.Transpose[m]IdentityMatrix[n]:

Out[2]=2

For an approximate matrix, the identity is approximately true:

Out[4]=4

The inverse of an orthogonal matrix is its transpose:

Out[2]=2

Thus, the inverse and transpose are orthogonal matrices as well:

Out[3]=3

A real orthogonal matrix preserves the standard inner product of vectors in TemplateBox[{}, Reals]^n:

Out[1]=1

As a consequence, real orthogonal matrices preserve norms as well:

Out[2]=2
Out[3]=3

Any real-valued orthogonal matrix is unitary:

Out[2]=2

But a complex unitary matrix is typically not orthogonal:

Out[4]=4

Products of orthogonal matrices are orthogonal:

Out[1]=1
Out[2]=2

A real-valued orthogonal matrix is normal:

Out[2]=2

A complex-valued orthogonal matrix need not be normal:

Out[4]=4

Real-valued orthogonal matrices have eigenvalues that lie on the unit circle:

Out[2]=2

Use Eigenvalues to find eigenvalues:

Out[3]=3

Verify they lie on the unit circle:

Out[4]=4

This does not apply to complex-valued orthogonal matrices:

Out[5]=5
Out[6]=6

Real orthogonal matrices have a complete set of eigenvectors:

Out[2]=2

As a consequence, they must be diagonalizable:

Out[3]=3

Use Eigenvectors to find eigenvectors:

Out[4]=4

A complex orthogonal matrix can fail to be diagonalizable:

Out[6]=6

The singular values are all 1 for a real orthogonal matrix:

Out[2]=2
Out[3]=3

This need not be true for a complex orthogonal matrix:

Out[5]=5
Out[6]=6

The determinant of an orthogonal matrix is 1 or :

Out[2]=2

The 2-norm of a real orthogonal matrix is always 1:

Out[2]=2

This need not be true for complex orthogonal matrices:

Out[4]=4

Integer powers of orthogonal matrices are orthogonal:

Out[2]=2
Out[3]=3

MatrixExp[m] for real antisymmetric m is both orthogonal and unitary:

Out[2]=2

For complex antisymmetric m, the exponential is orthogonal but not, in general, unitary:

Out[4]=4

OrthogonalMatrix can be used to explicitly construct orthogonal matrices:

Out[1]=1

These satisfy OrthogonalMatrixQ:

Out[2]=2

Possible Issues  (1)Common pitfalls and unexpected behavior

OrthogonalMatrixQ uses the definition TemplateBox[{m}, Transpose].m=I_n for both real- and complex-valued matrices:

Out[2]=2

These complex matrices need not be normal or possess many properties of real orthogonal matrices:

Out[3]=3

UnitaryMatrixQ tests the more common definition TemplateBox[{m}, ConjugateTranspose].m=I_n that ensures a complex matrix is normal:

Out[4]=4

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

Out[6]=6

Neat Examples  (1)Surprising or curious use cases

Rotation matrices are orthogonal:

Out[3]=3
Out[4]=4
Wolfram Research (2014), OrthogonalMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/OrthogonalMatrixQ.html.
Wolfram Research (2014), OrthogonalMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/OrthogonalMatrixQ.html.

Text

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

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

CMS

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

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

APA

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

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

BibTeX

@misc{reference.wolfram_2025_orthogonalmatrixq, author="Wolfram Research", title="{OrthogonalMatrixQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/OrthogonalMatrixQ.html}", note=[Accessed: 01-April-2025 ]}

@misc{reference.wolfram_2025_orthogonalmatrixq, author="Wolfram Research", title="{OrthogonalMatrixQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/OrthogonalMatrixQ.html}", note=[Accessed: 01-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_orthogonalmatrixq, organization={Wolfram Research}, title={OrthogonalMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/OrthogonalMatrixQ.html}, note=[Accessed: 01-April-2025 ]}

@online{reference.wolfram_2025_orthogonalmatrixq, organization={Wolfram Research}, title={OrthogonalMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/OrthogonalMatrixQ.html}, note=[Accessed: 01-April-2025 ]}