**2.2. QR algorithm**

In this section we will present the QR algorithm. In numerical linear algebra, the **QR algo‐ rithm** is an eigenvalue algorithm : that is, a procedure to calculate the eigenvalues and eigenvectors of a matrix. QR algorithm represent factorization method, because it is based on the matrix decomposition. First factorization method labeled as LR algorithm is developed by H. Rutishauser in 1958. LR algorithm is due to the many shortcomings, today is rarely used, (Wilkinson monograph). Better factorization method, is designated as the QR algorithm. The basic form have developed independently from each other, in 1962 G. F. Francis (England) and by Vera N. Kublanskoovskaya (USSR). Today, it is the best method for solving the unsym‐ metrical eigenvalue problems, when you want to determine all the eigenvalues of the matrix. It is particularly effective when it is brought into the so-called matrix "Condensed form". Condensed form is for the unsymmetrical problem Hessenberg form. About Hessenberg form will be discussed more later. The basic idea is to perform a QR decomposition, writing the matrix as a product of an orthogonal matrix and an upper triangular matrix, multiply the factors in the reverse order, and iterate.

For understanding of the QR algorithm we will need the following terms:

**Definition 2.2.1.** Matrix *Q* ∈ *P*(*n*,*n*) called orthogonal if worth *Q<sup>T</sup>Q* = *I*.

**Remark 2.2.1.**Orthogonal matrix represent special case of unitary matrices. The Matrix *U* ∈ ℂ(*n*,*n*) called unitary if applies *U<sup>H</sup>U* = *I*. It is now clear that the orthogonal matrix of a unitary matrix in which all elements of real numbers. In practice, of course, is easier to work with the orthogonal than unitary matrices.

**Remark 2.2.2** Orthogonal and unitary matrices are normal matrices.

Let *A* and *B* are similar matrices. If the similarity transformations performed by the orthogonal or unitary matrix *Q* i.e. if applies *B* = *Q<sup>T</sup>AQ* or *B* = *U<sup>H</sup>AU* we will say that the matrices *A* and *B* are unitary similar. Since the unitary similar matrices are special special case of similar matrix, the eigenvalues of unitary similar matrices are the same.

In addition to the unitary similar matrices and their properties for the introduction of the QR algorithm, we will need the following theorem.

**Theorem 2.2.1.** Let's *A* ∈ *ℝ*(*n*,*n*) regular matrix, then there is a decomposition *A* = *QR*, where is *Q* orthogonal matrix and *R* upper triangular matrix. If the diagonal elements of the matrix *R* are positive, decomposition is unique.

The decomposition of the matrix *A* from Theorem 2.2.1 is called the QR decomposition of the matrix *A*.

The following is a basic form of the QR algorithm.

Let *A***0** := *A*. The basic forms of the QR algorithm is given by

**Algorithm 2.2.1 .** (QR algorithm-basic forms)

For *i* = 0, 1, ⋯ until convergence

To the above two problems are obviously equivalent to the following theorem.

, ⋯, **x***<sup>n</sup>*., at its column vectors.

As consequence of Theorem 2.1.8. and Theorem 2.1.9 ., we obtain the following important

There are matrices that can have the same eigenvalues and yet can be diagonalizable. Broadest such class of such matrices are normal matrix, which we will introduce the following definition.

More general characterization of diagonalizable matrix A is given in the following theorem *.*

**a.** For every eigenvalue of *A* the geometric multiplicity is less than or equal to the algebraic

**b.** *A* is diagonalizable if and if the geometric multiplicity is equal to the algebraic multiplicity

In this section we will present the QR algorithm. In numerical linear algebra, the **QR algo‐ rithm** is an eigenvalue algorithm : that is, a procedure to calculate the eigenvalues and

, for *i* = 1, 2, ⋯, *n*.

*AP* then will be diagonal with *λ*1, *λ*2, ⋯, *λ<sup>n</sup>* successive diagonal entries, where

are eigenvectors of *A* corresponding to distinct eigenvalues *λ*1, *λ*2, ⋯, *λk*, then

is called normal, if holds *A<sup>H</sup>A* = *AA<sup>H</sup>*.

, **x**<sup>2</sup> , ⋯, **x***<sup>n</sup>*.

If *A* is an *n* × *n* matrix, then the following are equivalent.

**b.** *A* has *n* linearly independent eigenvectors.

**Algorithm for Diagonalizing a Matrix**

is eigenvalue corresponding to **x**<sup>i</sup>

**Definition 2.1.5 .** Matrix *A* ∈ ℂ(*n*,*n*)

If *A* is a square matrix, then:

for every eigenvalue.

multiplicity.

**2.2. QR algorithm**

The following algorithm is for diagonalizing a matrix

} is a linearly independent set.

If an *n* × *n* matrix *A* has *n* distinct eigenvalues, then *A* is diagonalizable.

Find *n* linearly independent eigenvectors of *A,* marked as **x**<sup>1</sup>

, **x**<sup>2</sup>

**Theorem 2.1.8.**

62 Applied Linear Algebra in Action

The matrix *P*<sup>−</sup>**<sup>1</sup>**

**Theorem 2.1.9.**

**Theorem 2.1.10.**

**Theorem 2.1.11.**

*λi*

If **x**<sup>1</sup> , **x**<sup>2</sup> , ⋯, **x***<sup>k</sup>*

result

{**x**<sup>1</sup> , **x**<sup>2</sup> , ⋯, **x***<sup>k</sup>*

**a.** *A* is diagonalizable.

Form the matrix *P* having **x**<sup>1</sup>

Decompose *Ai* = *Qi Ri* (QR decomposition) *A RQ i ii* <sup>+</sup>**<sup>1</sup>** =

End

**Theorem 2.2.1** All matrices *Ai* resulting in algorithms 2.2.1 are unitary similar.
