15.6. MATLAB AND THE QR ALGORITHM 367

The number in the third row and second column is so small that we neglect it. All thatremains is to find the eigenvalues are the two blocks(

.6761 −.73721.5344 1.3435

),

(−1.3435 −4.18851.5344 3.3239

)Thus the eigenvalues of the original matrix are those which result from these two blocks.Since these are 2× 2 matrices, you can find the answer from the quadratic formula. Thusthe eigenvalues are

1.0098+1.0099i,1.0098−1.0099i,

0.9902+0.99029i,0.9902−0.99029i

In fact, the eigenvalues are exactly 1+ i,1+ i,1− i,1− i listed according to multiplicity.Now you can use the shifted inverse power method to find much better approximations aswell as eigenvectors. For example, you would use that algorithm to find the eigenvalueclose to 0.9902+ 0.99029i along with the associated eigenvector. It yields 1+ i as theeigenvalue closest to 0.99+0.99i along with the eigenvector(

1 0.5−0.5i −0.5i −0.25−0.25i)T

Of course we didn’t care about the eigenvector but there it is anyway. It took 844 iterationseven though 0.99+0.99i was very close to the true eigenvalue.

Example 15.6.6 Find the eigenvalues for the symmetric matrix

A =

1 2 3 −12 0 1 33 1 3 2−1 3 2 1

Also find an eigenvector.

A Hessenberg matrix similar to the above matrix is

H =

.0888 −.6421 0 0−.6421 3.8398 −3.348 0

0 −3.348 .0714 −3.74170 0 −3.7417 1

Thus you could use the QR algorithm on this to identify the eigenvalues. In using thisalgorithm, MATLAB already knows H unless you did clear all or close all. Thus you don’tneed to enter the matrix in the QR algorithm. You just need to refer to H.

This yields 6.643 0 0 0

0 −4.1018 0 00 0 2.4589 00 0 0 0

