HermitianMatrixQ

HermitianMatrixQ[m]

gives True if m is explicitly Hermitian, and False otherwise.

Details and Options

  • HermitianMatrixQ is also known as a self-adjoint.
  • A matrix m is Hermitian if m==ConjugateTranspose[m].
  • HermitianMatrixQ works for symbolic as well as numerical matrices.
  • The following options can be given:
  • 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 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 all

Basic Examples  (2)

Test if a 2×2 numeric matrix is explicitly Hermitian:

Test if a 3×3 symbolic matrix is explicitly Hermitian:

Scope  (10)

Basic Uses  (6)

Test if a real machine-precision matrix is Hermitian:

A real Hermitian matrix is also symmetric:

Test if a complex matrix is Hermitian:

A complex Hermitian matrix has symmetric real part and antisymmetric imaginary part:

Test if an exact matrix is Hermitian:

Make the matrix Hermitian:

Use HermitianMatrixQ with an arbitrary-precision matrix:

A random matrix is typically not Hermitian:

Use HermitianMatrixQ with a symbolic matrix:

The matrix becomes Hermitian when c=TemplateBox[{b}, Conjugate] and diagonal entries are explicitly real-valued:

HermitianMatrixQ works efficiently with large numerical matrices:

Special Matrices  (4)

Use HermitianMatrixQ with sparse matrices:

Use HermitianMatrixQ with structured matrices:

Use with a QuantityArray structured matrix:

The identity matrix is Hermitian:

HilbertMatrix is Hermitian:

Options  (2)

SameTest  (1)

This matrix is Hermitian for a positive real , but HermitianMatrixQ gives False:

Use the option SameTest to get the correct answer:

Tolerance  (1)

Generate a complex-valued Hermitian matrix with some random perturbation of order 10-14:

Adjust the option Tolerance to accept this matrix as Hermitian:

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

Applications  (8)

Sources of Hermitian Matrices  (5)

A matrix generated from a Hermitian function is Hermitian:

The function is Hermitian:

By using Table, it generates a Hermitian matrix:

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

Convert back to an ordinary matrix using Normal:

The Pauli matrices are Hermitian:

Several statistical measures of complex data are Hermitian matrices, including Covariance:

Correlation:

AbsoluteCorrelation:

Matrices drawn from GaussianUnitaryMatrixDistribution are Hermitian:

Matrices drawn from GaussianSymplecticMatrixDistribution are Hermitian:

Uses of Hermitian Matrices  (3)

A positive-definite, Hermitian matrix or metric defines an inner product by :

Verify that is in fact Hermitian and positive definite:

Orthogonalize the standard basis of TemplateBox[{}, Complexes]^n to find an orthonormal basis:

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

In quantum mechanics, time evolution is represented by a 1-parameter family of unitary matrices . The times the logarithmic derivative of is a Hermitian matrix called the Hamiltonian or energy operator . Its eigenvalues represent the possible energies of the system. For the following time evolution, compute the Hamiltonian and possible energies:

First, verify the matrices are, in fact, unitary under the assumptions that and are real:

Compute the logarithmic derivative:

This matrix is antihermitian:

Define the Hamiltonian:

Verify that the matrix is Hermitian:

Its real eigenvalues represent the possible energies:

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

Construct complex-valued matrices for testing:

For the non-Hermitian matrix m, the function myLS just uses Gaussian elimination:

For the Hermitian indefinite matrix mh, try Cholesky and continue with Gaussian elimination:

For the Hermitian positive definite matrix mpd, try Cholesky, which succeeds:

Properties & Relations  (16)

HermitianMatrixQ[x] trivially returns False for any x that is not a matrix:

A matrix is Hermitian if m==ConjugateTranspose[m]:

A Hermitian matrix must have real diagonal elements:

Use Diagonal to pick out the diagonal elements:

A real-valued symmetric matrix is Hermitian:

But a complex-valued symmetric matrix may not be:

Use Symmetrize with the symmetry Hermitian to compute the Hermitian part of a matrix:

This equals mean of m and ConjugateTranspose[m]:

Any matrix can be represented as the sum of its Hermitian and antihermitian parts:

Use AntihermitianMatrixQ to test whether a matrix is antihermitian:

If is a Hermitian matrix, then is antihermitian:

MatrixExp[I h] is unitary for any Hermitian matrix h:

A Hermitian matrix is always a normal matrix:

Use NormalMatrixQ to test whether a matrix is normal:

Hermitian matrices have all real eigenvalues:

Use Eigenvalues to find eigenvalues:

CharacteristicPolynomial[m,x] for Hermitian m has real coefficients:

Moreover, it can be factored into linear terms:

Hermitian matrices have a complete set of eigenvectors:

As a consequence, they must be diagonalizable:

Use Eigenvectors to find eigenvectors:

Hermitian matrices have a real-valued determinant:

Use Det to compute the determinant:

The inverse of a Hermitian matrix is Hermitian:

Real-valued matrix functions of Hermitian matrices are Hermitian, including MatrixExp:

And any univariate analytic function representable using MatrixFunction:

Note that while integer matrix powers are Hermitian, noninteger powers are not:

HermitianMatrix can be used to explicitly construct Hermitian matrices:

These satisfy HermitianMatrixQ:

Possible Issues  (1)

A complex symmetric matrix is not Hermitian:

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

Text

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

CMS

Wolfram Language. 2007. "HermitianMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/HermitianMatrixQ.html.

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_hermitianmatrixq, organization={Wolfram Research}, title={HermitianMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/HermitianMatrixQ.html}, note=[Accessed: 22-November-2024 ]}