Application Center - Maplesoft

App Preview:

Hermitian Matrices

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application

              Hermitian Matrices 

The Nature Of Hermitian Matrices and the Property Of  

                  Their Eigenvalues and Eigenvectors 


                           By: Ali Mohamed Abuoam 


The purpose of this thesis is to illustrate the problem of Hermitian matrices, such as operations (on complex Hermitian), and to discuss and illustrate an interesting property of their Eigenvalues and Eigenvectors, and to illustrate why Hermitian matrices considered to read the representations of measurement operators in Heisenberg's version of quantum mechanics ? 


A matrix H is Hermitian, if it is equal to its conjugate transpose. A real matrix is Hermitian if and only if it is symmetric. Hence all Hermitian matrices are square. Hermitian Matrices named for the French mathematician Charles Hermite, 1822-1901.  


 4.1  Real Hermitian Matrices:  

To examine The following matrix if it is Hermitian or not? 

> restart; with(LinearAlgebra):

> A:=Matrix(3,3,[[4,-3,5],[-3,2,1],[5,1,-6]]);


It is symmetric, and then we expect that it is Hermitian, first evaluate its conjugate and then the transpose (although, the transpose and the conjugate are commutative): 

> `conj(A)`:=conjugate(A):`Conj(A)`:=evalm(conjugate(A)):`conj(A)`=matrix(`Conj(A)`);


Or, to use "map" and "conjugate": 

> `Conj(A)`:=map(conjugate,A):`conj(A)`=matrix(`Conj(A)`);



> `Conj(A)`:=map(x->conjugate(x),A):`conj(A)`=matrix(`Conj(A)`);


Then, one can use the transpose function to obtain the transpose-conjugate of the matrix A: 



Where B is the conjugate Of A. 

> Transpose(B);


It yield that matrix A is equal to its transpose conjugate, so A is a Hermitian matrix. This can be also done in one step: 

> HermitianTranspose(A);


Where "HermitianTranspose" command creates the 'transpose-conjugate' of a matrix directly, the command " evalm " evaluates an expression involving matrices. It performs any sums, products, or integers powers involving matrices, and will map functions onto matrices, " map " to apply a procedure to each operand of an expression, and ( `` ) are backquotes for maple keywords to reserve the word(words) without causing a syntax error. 


How to construct a Real Hermitian Matrix? 

To construct a real Hermitian matrix, first load the package: 


> restart; with(LinearAlgebra):


Then the Hermitian matrix will be the following: 

> H:=Matrix(1..6,1..6,(a,b)->a+2*b,shape=symmetric);


One can check that a matrix H is Hermitian, and it is important to use the option "shape=symmetric" because all real Hermitian matrices are symmetric. Now check: 

> HermitianTranspose(H);


So, we have the same result, and the procedure works, and one can construct a real Hermitian matrix of any dimension. 



 4.2  Complex Hermitian matrices: 

A matrix which has at least one of its entries complex number is called a complex matrix. In general, not all symmetric complex matrices are Hermitian (as in case of real matrices). Complex matrices (specially Hermitian), have found an important application in modern physics (Electrical and Other Engineering's purposes). Here we will illustrate some properties and operation on Hermitian complex matrices. 

First how to examine that a given complex matrix is Hermitian: 

> restart; with(LinearAlgebra):

> A:=Matrix(3,3,[[2,2+3*I,4-5*I],[2-3*I,5,6+2*I],[4+5*I,6-2*I,-7]]);


> HermitianTranspose(A);


Therefore, A is Hermitian. 


How to construct a Hermitian Complex Matrix? 

One can follow the same procedure which has done for a real matrix with some changes: 


> H:=Matrix(shape=hermitian,1..6,1..6,(a,b)->a+a*b*I);


To check: 

> HermitianTranspose(H);


So H is Hermitian. 

Another method, one can create any complex matrix, and to force " Maple " to construct a Hermitian matrix by using the option " shape=hermitian " :   


> M:=Matrix(5,5,[[2,3-2*I,4*I,I,2-I],[3-5*I,6*I,7-2*I,I,-6],[4*I,I,9,5*I,-8*I],[7*I,-3*I,4-6*I,5,I],[-9*I,2+4*I,8,4-5*I,I]]);


To construct a Hermitian matrix ' L ' from 'M': 

> L:=Matrix(M,shape=hermitian);


> HermitianTranspose(L);


So, the matrix L is Hermitian, and you can see the change that happened for the entries of M to be Hermitian. 



 4.3  How to construct a  Random Hermitian Matrix: 

To construct a random hermitian matrix, one can do the following: 

> restart; with(LinearAlgebra):


Where, "hrand" denotes hermitian-random, the operator  "`if`( i = j, r, r + I*r )()"  generates general complex numbers that are not compatible with the requirements that the leading diagonal elements are pure real (as a property of a hermitian matrix). On other words: if i = j, insert real number, else, complex number. 

To check the diagonal of H:  

> A:=Diagonal(H);



> R:=Matrix(6,random,r+I*r,shape=hermitian);


Also one can check if R is hermitian ( Indeed hermitian ). Moreover, one can use the following to construct a general random hermitian matrix of pure imaginary entries and zeros on the main diagonal: 

> K:=Matrix(6,random,r*I,shape=hermitian);



Also, one can check: 

> HermitianTranspose(K);





    4.4  Various Operations On Complex Hermitian Matrices: 

Consider the following Hermitian matrix ( acting with simple matrix ), the matrix that to work with: 

> restart; with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

> N:=matrix(3,3,[[1,1+I,2*I],[1-I,4,2-3*I],[-2*I,2+3*I,7]]);


1: To obtain a matrix containing only the 'real' parts of the elements of N, use the following: 

> `Re(N)`:=evalm(Re(N)):`Re(N)`=matrix(`Re(N)`);




> `Re(N)`:=map(Re,N):`Re(N)`=matrix(`Re(N)`);


Or, one can use the short way:  

> `Re(N)`:=evalm(Re(N));


One can call any element of "Re(N)", as follows: 

> `Re(N)`[2,1]; `Re(N)`[3,2]; `Re(N)`[2,3];

1   (21)

2    (21)

2    (21)

Where, the first argument is the row's number, and the second is for the column. 

One can observe that the matrix of the real parts of hermitian matrix (complex) is hermitian, since it is symmetric. 

2: To obtain a matrix containing  only the numerical value of 'imaginary' parts of the elements of N, do the following: 

> `Im(N)`:=evalm(Im(N)):`Im(N)`=matrix(`Im(N)`);




> `Im(N)`:=map(Im,N):`Im(N)`=matrix(`Im(N)`);




> `Im(N)`:=map(x->op(1,op(2,x)),N):`Im(N)`=matrix(`Im(N)`);




> `Im(N)`:=evalm(Im(N));


Also, one, can call any element of "Im(N)", as follows: 

> `Im(N)`[1,1]; `Im(N)`[1,2]; `Im(N)`[2,3];

0    (26)

1    (26)

-3    (26)

Here, the matrix of the numerical value of the imaginary parts of the elements of N isn't Hermitian (as in case of real parts): 


3: To obtain a matrix containing only the imaginary parts of entries of N, use the following: 


> `Im(N)I`:=evalm(N-`Re(N)`):`Im(N)I`=matrix(`Im(N)I`);


Or, one can use the following: 

> `Im(N)I`:=map(x->op(2,x),N):`Im(N)I`=matrix(`Im(N)I`);



Where, " op " to extract operands from an expression. 

Also, one can use the 'evalm' and 'Im' together multiplied by the imaginary unit " I ": 

> `Im(N)I`:=evalm(Im(N)*I):`Im(N)I`=matrix(`Im(N)I`);



> `Im(N)I`:=map(Im*I,N):`Im(N)I`=matrix(`Im(N)I`);



> evalm(`Im(N)I`);


4: To have a matrix with the elements of N expressed in polar form (to convert the complex-valued expression to its representation in polar coordinates.The expression is represented as "polar(r,t)", where 'r' is the modulus and 't' is the argument of the complex value of the expression ), for example: 

> N[i,j]=polar(N[i,j]);

N[i, j] = polar(abs(N[i, j]), argument(N[i, j]))    (32)

To have such matrix, let's do the following: 

> N_p:=map(x->convert(x,polar),N):N_p=matrix(N_p);


This corresponds to a counter-clockwise rotation through ' Pi ' radian. 

Or, one can use: 

> N_p:=map(x->polar(x),N):N_p=matrix(N_p);


or, as follows: 

> N_p:=map(polar,N):N_p=matrix(N_p);


5: The matrix containing the modulus (absolute value, or magintude in physical expression) of the elements of N: for this purpose do the following: 


> A:=evalm(abs(N));


Or, one can do the following: 

> `abs(N)`:=map(sqrt(Re^2+Im^2),N):abs(N)=matrix(`abs(N)`);



> `abs(N)`:=evalm(abs(N)):abs(N)=matrix(`abs(N)`);




One can see that in the first and last three methods, the result is finally computed for squared numbers. 

Also, one can give more exact result by using the method of floating-point evaluation for each of the above results: 

> `approx(abs(N))`:=evalf(matrix(`abs(N)`)):abs(N)=matrix(`approx(abs(N))`);


Where, " approx " is for a numerical approximation of functions, and " abs " is for absolute values. 

To make the entries rounded-off to ,say to 5 significant digits: 

> `approx(abs(N))`:=evalf(matrix(`abs(N)`),5):abs(N)=matrix(`approx(abs(N))`);


Where, " evalf  " evaluates to floating-point, or complex floating-point numbers, expressions ( or subexpressions ) involving constants such as Pi, exp(1), gamma, and functions such as exp, ln, sin, arctan, cosh. 


Or, one can use the following expression: 


> evalf(evalm(abs(N)),5);


6: To obtain a matrix containing the principal argument (in radians) of the elements of N, use the following: 

> evalm(argument(N));


The 'argument' function returns the principal value of the argument of the complex-valued expression x. Which means argument(x) = t specifies x = polar(abs(x),t) = abs(x)*exp(I*t), where -Pi <t<=Pi, So, for z = x + yI, argument(z) >= 0 if y >= 0. otherwise argument(z) < 0, if y = 0, argument(z) = 0. And of course " the argument of any real is zero". 

One can use other methods: 

> `arg(N)`:=evalm(argument(N)):Arg(N)=matrix(`arg(N)`);




To compute the floating-point of any of the above, one can use the following (to 4 digits): 

> evalf(evalm(argument(N)),4);


Or, using the longway: 

> `approx(arg(N))`:=evalf(matrix(`arg(N)`),4):Arg(N)=matrix(`approx(arg(N))`);



7: To obtain a matrix containing the principal argument ( in degree ) of the elements of N,( to 4 digits ) do the following: 

> `deg(arg(N))`:=evalf(evalm(argument(N)*180/Pi),4);




Or, one can use other methods: 

> evalf(evalm(`arg(N)`*180/Pi),4);




If, number 4 has been deleted, then the full fraction will appear ( in fact these methods gave great effort for practice in electrical engineering ). 


8: To define an auxiliary matrix of the same size as that of matrix N: 

Let's now consider a matrix of  rows-dimension and columns-dimension of matrix N: 

> n_p_e:=matrix(rowdim(N),coldim(N));

`assign`(n_p_e, array(1 .. 3, 1 .. 3, []))    (48)

To construct  a matrix [N_p_eng] containing " engineering " polar forms of the elements of N, do the following: 

> n_p_e1:=map(x->x*`@`,`abs(N)`): n_p_e2:=map(x->[x^`o`],`deg(arg(N))`):

> for i to rowdim(N) do :

> for j to coldim(N) do:

> n_p_e[i,j]:=n_p_e1[i,j]*n_p_e2[i,j]:

> N_p_eng:=matrix(n_p_e):N_p_eng=matrix(N_p_eng);


To obtain the floating-point of each entry: 

> M:=evalf(evalm(N_p_eng),4);


To extract any element of this matrix, and so it may be its numerical components: 

> M[2,1];

`+`(`*`(1.414, `*`(`@`, `*`([`^`(-45., o)]))))    (51)

Where, " @ " is the function composition operator. 

One, can use various methods: to extract any element: 

> evalf(evalm(n_p_e1[2,1]/`@`),4);

1.414    (52)

> evalf(evalm(n_p_e2[2,1]));



9: How to type a complex Hermitian matrix of which the elements are given in the polar form containing decimal numbers, and required to display them in this form? 

For this purpose the list of the elements must be enclosed in single quotes to prevent internal evaluation, for example: 

> C:=matrix(3,3,'[[0,-.7*exp(.6*I),.8*exp(.6*I)],[-.7*exp(-.6*I),0,-9*exp(.3*I)],[.8*exp(-.6*I),-9*exp(-.3*I),0]]');




What happens if the list of the elements was not quoted (deleting [ ' ] )? 

In this case all the elements will be evaluated internally and displayed in the canonical form (i.e,will be computed directly as floating-point numbers), one can see that: 

> H:=matrix(3,3,[[0,-.7*exp(.6*I),.8*exp(.6*I)],[-.7*exp(-.6*I),0,-9*exp(.3*I)],[.8*exp(-.6*I),-9*exp(-.3*I),0]]);


One can compare this with the floating-point numbers: 

> M:=convert(evalm(C),float);  M:=convert(op(C),float);



The same result as matrix H. 




   4.5   The Property Of  Eigenvalues and Eigenvectors of Hermitian Matrices: 

Here, to discuss and illustrate two important attributes of Hermitian matrices. first, their eigenvalues are always real-valued, Secondly, they are unitary similar to a diagonal matrix containing the eigenvalues. Moreover, their eigenvectors are mutually orthogonal ( assuming distinct eigenvalues ). To illustrate this, come along: 


  4.5.1  Real Hermitian matrices:  

Now construct a random real hermitian matrix: 

> restart; with(LinearAlgebra):

> S:=RandomMatrix(5);


> H:=Matrix(S,shape=hermitian);


Now, H is hermitian. To compute the eigenvalues and the eigenvectors of H,use the following command: 

> (T,Z):=SchurForm(H,output=['T','Z']);


Where, " SchurForm " function returns a matrix containing the Schur Form, which operates in the floating-point domain. Hence, the entries in a matrix must necessarily be of  type complex ( numeric). The reduction to Schur Form is done in two steps. The first is a reduction to upper Hessenberg Form is performed, and then further reduction to Schur Form is performed. 

If the matrix is real, the Schur Form is un upper quasi-triangular matrix T with 1x1 or  2x2  blocks on its diagonal. The blocks correspond to either eigenvalues, or complex conjugates pairs of eigenvalues, of the matrix argument. 

The eigenvalues of the matrix H are the elements of the diagonal of  T . To see that: 

> T;


To extract only the eigenvalues of H : 

> map(fnormal,T);


Hence the eigenvalues lay on the diagonal of  T . To check that: 

> E:=Eigenvalues(H):

> Ef:=evalf(E);


It's true. Also, one can observe that, they are real and distinct. 

THE matrix Z is unitary matrix satisfying the following: 

1: The product of the matrix Z with its transpose-conjugate is equal to the identity matrix I: 

> map(fnormal,Z.HermitianTranspose(Z));


The function " fnormal " gives the floating-point normalization , the ' fnormal is an expression equivalent to ' e '' under the assumption that all numeric values with magnitude less than epsilon may be considered to be zero( e is a list, set, range, series, equation, function, or a relation ). 


2: The product ( H.Z ) is equal to the product  ( Z.T ): 


> map(fnormal,H.Z);


> map(fnormal,Z.T);


It is so. 


3: The product of  transpose-conjugate of Z, with H, with Z is equal to  T: 

> map(fnormal,HermitianTranspose(Z).H.Z);


Remember T, or check: 

> map(fnormal,T);



4: Hence, the columns of Z are the eigenvectors of H: 

> map(fnormal,Z);


If a Hermitian matrix has positive eigenvalues,then it is positive definite. 



  4.5.2  Complex Hermitian Matrices: 

In the case of complex Hermitian matrices,the Schur Form is an upper triangular matrix T with the eigenvalues of matrix H on its diagonal.The complex Schur Vectors comprise the columns of the reducing unitary matrix Z which satisfying the four properties that shown previously. Now let us construct a complex Hermitian matrix M: 

First construct any complex matrix, say, N

> N:=Matrix(4,4,[[2+4*I,3-6*I,4+3*I,5*I],[5-8*I,7*I,9*I,7-2*I],[3-5*I,4-5*I,8*I,9-4*I],[5+9*I,4*I,2-7*I,I]]);


Then, construct a Hermitian matrix L :  

> L:=Matrix(N,shape=hermitian);


To obtain the Schur Form: 

> (T,Z):=SchurForm(L,output=['T','Z']);


The eigenvalues of L obtained from T like this: 

> map(fnormal,T);

One can see that the eigenvalues are real and distinct . 


The eigenvectors of L formed the columns of Z : 

> map(fnormal,Z);


They are complex. To check that the unitary matrix Z satisfied the remained three properties: 

> map(fnormal,Z.HermitianTranspose(Z));


It is equal to I. 

> map(fnormal,L.Z);


> map(fnormal,Z.T);


The two products are equal. 

Moreover, the product [ Inverse(Z).L.Z] is equal to the product [ transpose-conjugate(Z).L.Z] is equal to T: 

> map(fnormal,Z^(-1).L.Z);


> map(fnormal,HermitianTranspose(Z).L.Z);


The two products are equal and they are equal to T. 


By this interesting property of eigenvalues and eigenvectors, the Hermitian matrices have found an important application in modern physics, as the representations of measurement operators in Heisenberg's version of quantum mechanics. To each opservable parameter of a physical system there corresponds a Hermitian matrix whose eigenvalues are the possible values that can result from a measurement of that parameter,and whose eigenvectors are the corresponding states of the system following a measurement. Since a measurement yields precisely one real value and leaves the system in precisely one of a set of mutually exclusive ( orthogonal ) states, it is natural that the measurement values should correspond to the eigenvalues of Hermitian matrices, and the resulting states should be the eigenvectors.