OrthogonalMatrix[omat]
converts the orthogonal matrix omat to a structured array.
OrthogonalMatrix
OrthogonalMatrix[omat]
converts the orthogonal matrix omat to a structured array.
Details and Options
- Orthogonal matrices, when represented as structured arrays, allow for a convenient specification and more efficient operations, including Inverse and LinearSolve.
- Matrix decompositions that use orthogonal matrices include the QR, Hessenberg, Schur, singular value and polar decompositions. »
- A square orthogonal matrix
is a matrix whose transpose is equal to its inverse; that is, it satisfies the relation
. Consequently, the inverse of a square orthogonal matrix is also orthogonal. » - For a tall
orthogonal matrix
, the column vectors
are orthonormal so that
for
. For a wide orthogonal matrix
, the row vectors
are orthonormal so that
for
. For a square matrix, both statements are true. » - Equivalently to the preceding definition, a matrix
of dimensions
is orthogonal if
and
is the
identity matrix, or if
and
is the
identity matrix. » - Square orthogonal matrices are closed under matrix multiplication, so
is again an orthogonal matrix. » - For an OrthogonalMatrix sa, the following properties "prop" can be accessed as sa["prop"]:
-
"Matrix" orthogonal matrix, represented as a full array "Properties" list of supported properties "Structure" type of structured array "StructuredData" internal data stored by the structured array "StructuredAlgorithms" list of functions with special methods for the structured array "Summary" summary information, represented as a Dataset - Normal[OrthogonalMatrix[…]] gives the orthogonal matrix as an ordinary matrix.
- OrthogonalMatrix takes the following option:
-
TargetStructure Automatic structure to return - Possible settings for the option TargetStructure include:
-
Automatic automatically choose the representation returned "Dense" represent the matrix as a dense matrix "Structured" represent the matrix as a structured array - OrthogonalMatrix[…,TargetStructureAutomatic] is equivalent to OrthogonalMatrix[…,TargetStructure"Structured"].
Examples
open all close allBasic Examples (1)
Construct an orthogonal matrix:
om = OrthogonalMatrix[{{(1/2), (1/2), (1/2), (1/2)}, {(1/2), (1/2), -(1/2), -(1/2)}, {(1/2), -(1/2), -(1/2), (1/2)}, {(1/2), -(1/2), (1/2), -(1/2)}}]MatrixForm[om]Normal can convert an OrthogonalMatrix to its ordinary representation:
Normal[om]Scope (7)
Matrices corresponding to isometric transformations (reflections and rotations) are orthogonal:
OrthogonalMatrix[RotationMatrix[{{1, -1, 1, -1}, {-1, -1, 1, 1}}]]OrthogonalMatrix[ReflectionMatrix[{1, -1, 1, -1}]]Real reflection matrices are both orthogonal and symmetric:
rm = ReflectionMatrix[{1, -1, 1}]{OrthogonalMatrix[rm], SymmetricMatrix[rm]}co = OrthogonalMatrix[(| | | | |
| -------- | -------- | ------- | ------- |
| (5/4) | 0 | (3 I/4) | 0 |
| 0 | (5/4) | 0 | (3 I/4) |
| -(3 I/4) | 0 | (5/4) | 0 |
| 0 | -(3 I/4) | 0 | (5/4) |)]The matrix is orthogonal, but not unitary:
{OrthogonalMatrixQ[co], UnitaryMatrixQ[co]}A rectangular orthogonal matrix:
om = OrthogonalMatrix[{{(1/2 Sqrt[2]), (1/2 Sqrt[2]), (1/2 Sqrt[2])}, {(1/2 Sqrt[2]), (1/2 Sqrt[2]), (1/2 Sqrt[2])}, {(1/2 Sqrt[2]), (1/2 Sqrt[2]), -(1/2 Sqrt[2])}, {(1/2 Sqrt[2]), (1/2 Sqrt[2]), -(1/2 Sqrt[2])}, {(1/2 Sqrt[2]), -(1/2 Sqrt[2]), -(1/2 Sqrt[2])}, {(1/2 Sqrt[2]), -(1/2 Sqrt[2]), -(1/2 Sqrt[2])}, {(1/2 Sqrt[2]), -(1/2 Sqrt[2]), (1/2 Sqrt[2])}, {(1/2 Sqrt[2]), -(1/2 Sqrt[2]), (1/2 Sqrt[2])}}]Its transpose is also orthogonal:
Transpose[om]OrthogonalMatrix objects include properties that give information about the matrix:
om = OrthogonalMatrix[(| | | |
| ------ | ------ | ------ |
| -(1/3) | (2/3) | -(2/3) |
| -(2/3) | (1/3) | (2/3) |
| -(2/3) | -(2/3) | -(1/3) |)]om["Properties"]
The "Summary" property gives a brief summary of information about the matrix:
om["Summary"]The "StructuredAlgorithms" property lists the functions that have structured algorithms:
om["StructuredAlgorithms"]Create random orthogonal matrices using CircularRealMatrixDistribution:
OrthogonalMatrix /@ RandomVariate[CircularRealMatrixDistribution[4], 3]Create a wide orthogonal matrix by selecting rows from a square matrix:
square = OrthogonalMatrix[RandomVariate[CircularRealMatrixDistribution[5]]]square[[{1, 3, 4}]]Create another wide orthogonal matrix by selecting rows from this wide matrix:
%[[1 ;; 2]]Create a tall orthogonal matrix by extracting columns from a square matrix:
square[[All, {1, 3, 4}]]Create another tall orthogonal matrix by selecting rows from this tall matrix:
square[[All, 1 ;; 2]]Options (1)
TargetStructure (1)
Return the orthogonal matrix as a dense matrix:
OrthogonalMatrix[(| | | |
| ------ | ------ | ----- |
| -(1/3) | (2/3) | (2/3) |
| (2/3) | -(1/3) | (2/3) |
| -(2/3) | -(2/3) | (1/3) |), TargetStructure -> "Dense"]Return the orthogonal matrix as a structured array:
OrthogonalMatrix[(| | | |
| ------ | ------ | ----- |
| -(1/3) | (2/3) | (2/3) |
| (2/3) | -(1/3) | (2/3) |
| -(2/3) | -(2/3) | (1/3) |), TargetStructure -> "Structured"]Applications (5)
Matrices drawn from CircularRealMatrixDistribution are orthogonal:
OrthogonalMatrix[RandomVariate[CircularRealMatrixDistribution[9]]]o = RotationMatrix[Pi / 3, RandomReal[1, 3], TargetStructure -> "Orthogonal"]Orthogonal matrices preserve the standard inner product on
. In other words, if
is orthogonal and
and
are vectors, then
:
{u, v} = RandomReal[1, {2, 3}];
OrthogonalMatrixQ[o] && u.v == (o.u).(o.v)This means the angles between the vectors are unchanged:
VectorAngle[u, v] == VectorAngle[o.u, o.v]Since the norm is derived from the inner product, norms are preserved as well:
Norm[u] == Norm[o.u]Norm[v] == Norm[o.v]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:
m = OrthogonalMatrix[(| | |
| ------------------- | -------------------- |
| -0.9980858626557927 | -0.06184343753901693 |
| 0.06184343753901693 | -0.9980858626557927 |)]Det[m] == 1Thus, it is a pure rotation; the Cartesian unit vectors
and
maintain their relative positions:
o = {0, 0};i = UnitVector[1];j = UnitVector[2];
Graphics[{{StandardBlue, {Arrow[{o, m.i}], Dotted, Arrow[{o, i}]}}, {StandardRed, {Arrow[{o, m.j}], Dotted, Arrow[{o, j}]}}}]The following matrix is orthogonal but has determinant
:
m = OrthogonalMatrix[(| | |
| ------------------- | ------------------- |
| -0.6512037846116245 | -0.7589029127019458 |
| -0.7589029127019458 | 0.6512037846116244 |)]Det[m] == -1Thus, it includes a reflection; the Cartesian unit vectors
and
reverse their relative positions:
Graphics[{{StandardBlue, {Arrow[{o, m.i}], Dotted, Arrow[{o, i}]}}, {StandardRed, {Arrow[{o, m.j}], Dotted, Arrow[{o, j}]}}}]Orthogonal matrices play an important role in many matrix decompositions:
m = RandomReal[{-1., 1.}, {5, 5}];
{q, r} = QRDecomposition[m, TargetStructure -> "Structured"]{u, w, v} = SingularValueDecomposition[m, TargetStructure -> "Structured"]{s, t} = SchurDecomposition[m, TargetStructure -> "Structured"]{p, h} = HessenbergDecomposition[m, TargetStructure -> "Structured"]The matrix
is always orthogonal for any nonzero real vector
:
n = 5;
Subscript[ℋ, v_] := OrthogonalMatrix[IdentityMatrix[n] - 2 vv / v.v];
v = RandomReal[1, n];
Subscript[ℋ, v]
is called a Householder reflection; as a reflection, its determinant is
:
Det[Subscript[ℋ, v]]It represents a reflection through a plane perpendicular to
, sending
to
:
Subscript[ℋ, v].v == -vAny vector perpendicular to
is unchanged by
:
perp = Block[{w = RandomReal[1, n]}, w - Projection[w, v]];
Subscript[ℋ, v].perp == perpIn matrix computations,
is used to set to zero selected components of a given column vector
:
x = RandomReal[1, n];v = x - x[[1]] / Abs[x[[1]]] Norm[x]UnitVector[n, 1];
Subscript[ℋ, v].{x}//ChopProperties & Relations (8)
The transpose of a square OrthogonalMatrix is equivalent to the inverse of the original matrix:
o = OrthogonalMatrix[(| | | |
| ------ | ------ | ----- |
| -(1/3) | (2/3) | (2/3) |
| (2/3) | -(1/3) | (2/3) |
| -(2/3) | -(2/3) | (1/3) |)]Transpose[o] === Inverse[o]o.o == o.o == IdentityMatrix[3]Consequently, the transpose of a square orthogonal matrix is also orthogonal:
oAn orthogonal matrix obeys PseudoInverse[o]==ConjugateTranspose[o]:
s = OrthogonalMatrix[StructuredArray`StructuredData[{4, 4},
{{{0.4061307977691637, -0.4449068592345224, -0.38124958350208205, -0.7012591652085159},
{0.7713160203254789, 0.3583692765666902, 0.522004406169808, -0.06445508778706913},
{0.09273154148377766, 0.7457930112797919, -0.6567329637569658, -0.06241361914882445},
{0.4811758858324995, -0.34266912984008396, -0.38840953816015766, 0.7072380539918383}}, 0}]];
PseudoInverse[s] == Transpose[s]Unlike the relationship to Inverse, this is true irrespective of shape:
t = OrthogonalMatrix[StructuredArray`StructuredData[{2, 4},
{{{0.4061307977691637, -0.4449068592345224, -0.38124958350208205, -0.7012591652085159},
{0.7713160203254789, 0.3583692765666902, 0.522004406169808, -0.06445508778706913}}, 0}]];
PseudoInverse[t] == Transpose[t]w = OrthogonalMatrix[StructuredArray`StructuredData[{4, 2},
{{{0.4061307977691637, 0.7713160203254789}, {-0.4449068592345224, 0.3583692765666902},
{-0.38124958350208205, 0.522004406169808}, {-0.7012591652085159, -0.06445508778706913}}, 0}]];
PseudoInverse[w] == Transpose[w]For a tall
orthogonal matrix
, the columns
are orthonormal, i.e.
for
:
{t = OrthogonalMatrix[(| | |
| ------------ | ----------- |
| (1/Sqrt[3]) | (1/Sqrt[3]) |
| (-1/Sqrt[3]) | (1/Sqrt[3]) |
| (1/Sqrt[3]) | 0 |
| 0 | (1/Sqrt[3]) |)], w = t}Table[Subscript[t, [[All, i]]].Subscript[t, [[All, j]]] == KroneckerDelta[ij], {i, 2}, {j, 2}]For a wide orthogonal matrix, it is instead the rows that are orthonormal:
Table[Subscript[w, [[i]]].Subscript[w, [[j]]] == KroneckerDelta[ij], {i, 2}, {j, 2}]A matrix
of dimensions
is orthogonal if
and
is the
identity matrix:
w = RandomVariate[CircularRealMatrixDistribution[5], WorkingPrecision -> 6][[1 ;; 3]]//OrthogonalMatrixw.w == IdentityMatrix[3]Note that
is well defined, but not an identity matrix as
:
w.w//MatrixFormIf
, then
is orthogonal if
is the
identity matrix:
t = RandomVariate[CircularRealMatrixDistribution[4], WorkingPrecision -> 6][[All, 1 ;; 2]]//OrthogonalMatrixt.t == IdentityMatrix[2]Again, the product in the opposite order is well defined but not an identity matrix:
t.t//MatrixFormThe product of two square orthogonal matrices is another orthogonal matrix:
{o1, o2} = OrthogonalMatrix /@ RandomVariate[CircularRealMatrixDistribution[3], 2]o1.o2A real orthogonal matrix is also a unitary matrix:
o = OrthogonalMatrix[(| | | |
| ------ | ------ | ------ |
| -(1/3) | (2/3) | -(2/3) |
| -(2/3) | (1/3) | (2/3) |
| -(2/3) | -(2/3) | -(1/3) |)]{UnitaryMatrixQ[o], OrthogonalMatrixQ[o] && MatrixQ[o, RealValuedNumberQ]}Convert from one type of matrix to the other:
UnitaryMatrix[o]PolarDecomposition by default returns an OrthogonalMatrix object when the input is real:
PolarDecomposition[RandomReal[1, {3, 3}]]OrderedSchurDecomposition by default returns an OrthogonalMatrix object when the input is real:
OrderedSchurDecomposition[RandomReal[1, {3, 3}]]Related Guides
History
Text
Wolfram Research (2024), OrthogonalMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/OrthogonalMatrix.html.
CMS
Wolfram Language. 2024. "OrthogonalMatrix." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/OrthogonalMatrix.html.
APA
Wolfram Language. (2024). OrthogonalMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OrthogonalMatrix.html
BibTeX
@misc{reference.wolfram_2026_orthogonalmatrix, author="Wolfram Research", title="{OrthogonalMatrix}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/OrthogonalMatrix.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_orthogonalmatrix, organization={Wolfram Research}, title={OrthogonalMatrix}, year={2024}, url={https://reference.wolfram.com/language/ref/OrthogonalMatrix.html}, note=[Accessed: 13-June-2026]}