OrthogonalMatrixQ

OrthogonalMatrixQ[m]

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)

Test if a 2×2 numeric matrix is orthogonal:

Test if a 3×3 symbolic matrix is orthogonal:

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

Scope  (14)

Basic Uses  (6)

Test if a real matrix is orthogonal:

A real orthogonal matrix is also unitary:

Test if a complex matrix is orthogonal:

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

A complex-valued orthogonal matrix is not unitary:

Test if an exact matrix is orthogonal:

Make the matrix orthogonal:

Use OrthogonalMatrixQ with arbitrary-precision matrix:

A random matrix is typically not orthogonal:

Use OrthogonalMatrixQ with a symbolic matrix:

The matrix becomes orthogonal when and :

OrthogonalMatrixQ works efficiently with large numerical matrices:

Special Matrices  (4)

Use OrthogonalMatrixQ with sparse matrices:

Use OrthogonalMatrixQ with structured matrices:

The identity matrix is orthogonal:

HilbertMatrix is not orthogonal:

Rectangular Semi-orthogonal Matrices  (4)

Test if a rectangular matrix is semi-orthogonal:

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

The columns are not orthonormal:

Test a matrix with more rows than columns:

The columns of the matrix are orthonormal:

The rows are not orthonormal:

Generate a random orthogonal matrix:

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

As does any subset of its columns:

Rectangular identity matrices are semi-orthogonal:

Options  (4)

Normalized  (2)

Symbolic orthogonal matrix columns are often not normalized to 1:

Avoid testing if the columns are normalized:

Multiply the second column of an orthogonal matrix by 2:

OrthogonalMatrixQ with NormalizedFalse will still give True for m:

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

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

SameTest  (1)

This matrix is orthogonal for a positive real , but OrthogonalMatrixQ 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-13:

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

Adjust the option Tolerance for accepting the matrix as orthogonal:

Tolerance is applied to the following value:

Applications  (10)

Sources of Orthogonal Matrices  (5)

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

The basis is orthonormal:

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

Putting them in columns also gives an orthogonal matrix:

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

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

But the starting matrix must have full rank:

Any rotation matrix is orthogonal:

Any permutation matrix is orthogonal:

Matrices drawn from CircularRealMatrixDistribution are orthogonal:

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 :

This means the angles between the vectors are unchanged:

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

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 :

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

The following matrix is orthogonal but has determinant :

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

Orthogonal matrices play an important role in many matrix decompositions:

The matrix is always orthogonal for any nonzero real vector :

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

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

Any vector perpendicular to is unchanged by :

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

Find the function satisfying the following differential equation:

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

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

Verify that satisfies the differential equation and initial condition:

The matrix is orthogonal for all values of :

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

Properties & Relations  (14)

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

For an approximate matrix, the identity is approximately true:

The inverse of an orthogonal matrix is its transpose:

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

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

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

Any real-valued orthogonal matrix is unitary:

But a complex unitary matrix is typically not orthogonal:

Products of orthogonal matrices are orthogonal:

A real-valued orthogonal matrix is normal:

A complex-valued orthogonal matrix need not be normal:

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

Use Eigenvalues to find eigenvalues:

Verify they lie on the unit circle:

This does not apply to complex-valued orthogonal matrices:

Real orthogonal matrices have a complete set of eigenvectors:

As a consequence, they must be diagonalizable:

Use Eigenvectors to find eigenvectors:

A complex orthogonal matrix can fail to be diagonalizable:

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

This need not be true for a complex orthogonal matrix:

The determinant of an orthogonal matrix is 1 or :

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

This need not be true for complex orthogonal matrices:

Integer powers of orthogonal matrices are orthogonal:

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

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

OrthogonalMatrix can be used to explicitly construct orthogonal matrices:

These satisfy OrthogonalMatrixQ:

Possible Issues  (1)

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

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

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

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

Neat Examples  (1)

Rotation matrices are orthogonal:

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.

CMS

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_orthogonalmatrixq, organization={Wolfram Research}, title={OrthogonalMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/OrthogonalMatrixQ.html}, note=[Accessed: 03-December-2024 ]}