Module

for

The QR Method for Eigenvalues

     

Background for QR Method

    Suppose that A is a real symmetric matrix.  Householder’s method is used to construct a similar tridiagonal matrix.  Then the QR method is used to find all eigenvalues of the tridiagonal matrix.  In the latter construction, plane rotations similar to those that were introduced in Jacobi’s method are used to construct the orthogonal matrices  [Graphics:Images/QRmethodMod_gr_1.gif].  The important step the QR method is the factorization  [Graphics:Images/QRmethodMod_gr_2.gif]  and iteration  [Graphics:Images/QRmethodMod_gr_3.gif].  

 

Definition (QR Decomposition).    For a nonsingular square matrix  [Graphics:Images/QRmethodMod_gr_4.gif], there exists a factorization    

        [Graphics:Images/QRmethodMod_gr_5.gif]

where  [Graphics:Images/QRmethodMod_gr_6.gif]  is a unitary and  [Graphics:Images/QRmethodMod_gr_7.gif]  is an upper triangular matrix.  Remark.  [Graphics:Images/QRmethodMod_gr_8.gif]  is a unitary means  [Graphics:Images/QRmethodMod_gr_9.gif].

    For a real nonsingular square matrix  [Graphics:Images/QRmethodMod_gr_10.gif], there exists a factorization    

        [Graphics:Images/QRmethodMod_gr_11.gif]

where  [Graphics:Images/QRmethodMod_gr_12.gif]  is an orthogonal matrix and  [Graphics:Images/QRmethodMod_gr_13.gif]  is an upper triangular matrix.  Remark.  [Graphics:Images/QRmethodMod_gr_14.gif]  is a orthogonal means  [Graphics:Images/QRmethodMod_gr_15.gif]  (also [Graphics:Images/QRmethodMod_gr_16.gif]).  

 

Example 1.  Find the QR decomposition of the matrix  [Graphics:Images/QRmethodMod_gr_17.gif].  
Solution 1.

 

Example 2.  Find the  [Graphics:Images/QRmethodMod_gr_41.gif]  decomposition of the matrix  [Graphics:Images/QRmethodMod_gr_42.gif].  
2 (a).  Perform the computation using decimal arithmetic.  
2 (a).  Perform the computation using exact arithmetic.  
Solution 2 (a).
Solution 2 (b).

 

 

QR transformation

    After finding the  [Graphics:Images/QRmethodMod_gr_84.gif]  factorization, the [Graphics:Images/QRmethodMod_gr_85.gif] transformation is  

        [Graphics:Images/QRmethodMod_gr_86.gif].   

Remark.  We will not write our own subroutine for finding the   [Graphics:Images/QRmethodMod_gr_87.gif]  factorization, we will use Mathematica's subroutine.   

 

QR Method

    We now investigate a well known and efficient method for finding all the eigenvalues of a general [Graphics:Images/QRmethodMod_gr_88.gif] real matrix.  The [Graphics:Images/QRmethodMod_gr_89.gif] method can be used for an arbitrary real matrix, but for a general matrix it takes many iterations and becomes time consuming.   
    
    The [Graphics:Images/QRmethodMod_gr_90.gif] method works much faster on special matrices, preferably:  
        (i)   symmetric  tri-diagonal,  
        (ii)  Hessenberg matrices,  
        (iii) symmetric  band matrices.  
    
    For this module, we will illustrate the QR method for  [Graphics:Images/QRmethodMod_gr_91.gif] real symmetric matrices.  

    When solving for eigenvalues of a dense symmetric matrix [Graphics:Images/QRmethodMod_gr_92.gif], the standard practice is to reduce the dense matrix to a tridiagonal matrix [Graphics:Images/QRmethodMod_gr_93.gif] through a series of orthogonal transformations, and then to apply an eigenvalue solver for tridiagonal matrices to [Graphics:Images/QRmethodMod_gr_94.gif].  The transformations applied to [Graphics:Images/QRmethodMod_gr_95.gif] preserve eigenvalues, and the eigenvalues of [Graphics:Images/QRmethodMod_gr_96.gif] and [Graphics:Images/QRmethodMod_gr_97.gif] are the same.

    The popular eigenvalue solver for symmetric tridiagonal matrices is called the implicit[Graphics:Images/QRmethodMod_gr_98.gif] method.  It applies a series of orthogonal transformations [Graphics:Images/QRmethodMod_gr_99.gif] to a tridiagonal matrix [Graphics:Images/QRmethodMod_gr_100.gif] which converges to a diagonal matrix [Graphics:Images/QRmethodMod_gr_101.gif].  Furthermore, [Graphics:Images/QRmethodMod_gr_102.gif] has the same eigenvalues as [Graphics:Images/QRmethodMod_gr_103.gif] which are the diagonal elements of [Graphics:Images/QRmethodMod_gr_104.gif].  In addition, the product of the orthogonal transformations [Graphics:Images/QRmethodMod_gr_105.gif] is a matrix whose columns are the eigenvectors of [Graphics:Images/QRmethodMod_gr_106.gif].  The method is called [Graphics:Images/QRmethodMod_gr_107.gif] because in each iteration the [Graphics:Images/QRmethodMod_gr_108.gif] factorization is computed.  The LAPACK routine implementing the implicit [Graphics:Images/QRmethodMod_gr_109.gif] algorithm on tridiagonal symmetric matrices is called DSTEQR.

 

QR Algorithm.  The pseudocode for the QR method is:

        1.  i = 0  
        2.  [Graphics:Images/QRmethodMod_gr_110.gif]    
        3.  repeat  
        4.       Factor  [Graphics:Images/QRmethodMod_gr_111.gif]  
        5.            [Graphics:Images/QRmethodMod_gr_112.gif]
        6.            i = i+1  
        7.  until convergence  

Proof  The QR Method  The QR Method  

 

Computer Programs  The QR Method  The QR Method  

Mathematica Subroutine (QR method).  To reduce the  [Graphics:Images/QRmethodMod_gr_113.gif]  real tri-diagonal matrix   [Graphics:Images/QRmethodMod_gr_114.gif]  to diagonal form.  

[Graphics:Images/QRmethodMod_gr_115.gif]

Example 3.  Apply the QR method to transform the tri-diagonal matrix   [Graphics:Images/QRmethodMod_gr_116.gif]  into diagonal matrix D that has the same eigenvalues.  
Solution 3.

 

 

Reduction to Hessenberg Form

    
We
need to find the Hessenberg form.  Suppose that [Graphics:Images/QRmethodMod_gr_169.gif] is a symmetric [Graphics:Images/QRmethodMod_gr_170.gif] matrix.  Start with

    [Graphics:Images/QRmethodMod_gr_171.gif]  

Construct the sequence  
[Graphics:Images/QRmethodMod_gr_172.gif]  of Householder matrices, so that

    
[Graphics:Images/QRmethodMod_gr_173.gif]   for   [Graphics:Images/QRmethodMod_gr_174.gif],  

where
[Graphics:Images/QRmethodMod_gr_175.gif] has zeros below the subdiagonal in columns  [Graphics:Images/QRmethodMod_gr_176.gif].  Then  [Graphics:Images/QRmethodMod_gr_177.gif]  is a Hessenberg matrix that is similar to [Graphics:Images/QRmethodMod_gr_178.gif]. This process is called Householder’s method.

    We are most interested in
finding eigenvalues of symmetric matrices.  If  A  is symmetric, then the above process will construct a symmetric tri-diagonal matrix. we will build on this theme. As mentioned previously, the QR iteration will work faster on tri-diagonal matrices  

Proof  The QR Method  The QR Method  

 

Computer Programs  The QR Method  The QR Method  

Mathematica Subroutine (Householder reduction to upper-Hessenberg Form).  To reduce the  [Graphics:Images/QRmethodMod_gr_179.gif]  real matrix  [Graphics:Images/QRmethodMod_gr_180.gif]  to Hessenberg form by using  [Graphics:Images/QRmethodMod_gr_181.gif] Householder transformations. The following version of the program uses "loops" extensively and is more traditional in programming structure.  It also contains a print statement so that you can watch the Householder transformations perform their "magic."  

[Graphics:Images/QRmethodMod_gr_182.gif]

Example 4.  Apply the QR method and find the eigenvalues of the following matrix  [Graphics:Images/QRmethodMod_gr_183.gif].  
Solution 4.

 

 

Acceleration shifts for the QR method

    As outlined above QR method will work, but convergence is slow, even for matrices of small dimension.  We can add a shifting technique that speeds up the rate of convergence.  Recall that if  [Graphics:Images/QRmethodMod_gr_267.gif] is an eigenvalue of  A, then  [Graphics:Images/QRmethodMod_gr_268.gif]  is an eigenvalue of the matrix  [Graphics:Images/QRmethodMod_gr_269.gif]. This idea is incorporated in the modified step  

        
[Graphics:Images/QRmethodMod_gr_270.gif]
then form
        
[Graphics:Images/QRmethodMod_gr_271.gif]    for   [Graphics:Images/QRmethodMod_gr_272.gif],  

where  [Graphics:Images/QRmethodMod_gr_273.gif]  is a sequence whose sum is  [Graphics:Images/QRmethodMod_gr_274.gif];  that is, [Graphics:Images/QRmethodMod_gr_275.gif].

Proof  The QR Method  The QR Method  

 

Computer Programs  The QR Method  The QR Method  

Mathematica Subroutine (QR method with shifts).  To reduce the  [Graphics:Images/QRmethodMod_gr_276.gif]  real tri-diagonal matrix [Graphics:Images/QRmethodMod_gr_277.gif] to diagonal form.  

[Graphics:Images/QRmethodMod_gr_278.gif]

Example 5.  Apply the QR method with shifts and find the eigenvalues of the following matrix  [Graphics:Images/QRmethodMod_gr_279.gif].  
Solution 5.

 

 

Application of the QR Factorization to "least squares"

    Is is common practice to use the  A = QR  factorization for underdetermined system and get a "least squares solution."   We will illustrate the method for the problem of finding a "least squares parabola."

An overdetermined system of equations will arise which does not have a solution

        MX = B  

The QR factorization of  M  is obtained  [Graphics:Images/QRmethodMod_gr_329.gif],  and we "wish" to solve
        
        [Graphics:Images/QRmethodMod_gr_330.gif]  

Multiplication on the left by  [Graphics:Images/QRmethodMod_gr_331.gif]  produces the system  

        [Graphics:Images/QRmethodMod_gr_332.gif][Graphics:Images/QRmethodMod_gr_333.gif]

which we will be able to solve in the form

        [Graphics:Images/QRmethodMod_gr_334.gif].  

The details in Example 7 will make clear what is happening.

 

Example 6.  Find the "least squares parabola" through the six points  [Graphics:Images/QRmethodMod_gr_335.gif].  
Use Mathematica's subroutine Fit to find the solution.
Solution 6.

 

Example 7.  Find the "least squares parabola" through the six points  [Graphics:Images/QRmethodMod_gr_345.gif].  Write down six equations in three unknowns that we "wish" could be solved.  Observe that this is an underdetermined system and envision a "least squares solution."   
Use the A = QR factorization to get a "least squares solution. "
Solution 7.

 

Research Experience for Undergraduates

The QR Method  The QR Method  Internet hyperlinks to web sites and a bibliography of articles.  

 

Download this Mathematica Notebook The QR Method for Eigenvalues

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004