ArticleslgStudy

mathematics

QR decomposition

QR decomposition is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand QR decomposition rather than just read about it. In short: In linear algebra, a QR decomposition, also known as a QR factorization or QU factorization, is a decomposition of a matrix A into a product A = QR of an orthonormal matrix Q and an upper triangular matrix R. QR decomposition is often used to solve the linear least squares (LLS) problem and is the basis for a particular eigenvalue algorithm, the QR algorithm.

QR decomposition — main illustration
QR decomposition — illustration

Key takeaways

  • QR decomposition belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect QR decomposition to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of QR decomposition from memory before moving on to harder problems.

Reference excerpt

In linear algebra, a QR decomposition, also known as a QR factorization or QU factorization, is a decomposition of a matrix A into a product A = QR of an orthonormal matrix Q and an upper triangular matrix R. QR decomposition is often used to solve the linear least squares (LLS) problem and is the basis for a particular eigenvalue algorithm, the QR algorithm.

Cases and definitions

Square matrix Any real square matrix A may be decomposed as

A = Q R , {\displaystyle A=QR,}

where Q is an orthogonal matrix (its columns are orthogonal unit vectors meaning Q T = Q − 1 {\displaystyle Q^{\textsf {T}}=Q^{-1}} ) and R is an upper triangular matrix (also called right triangular matrix). If A is invertible, then the factorization is unique if we require the diagonal elements of R to be positive. If instead A is a complex square matrix, then there is a decomposition A = QR where Q is a unitary matrix (so the conjugate transpose Q † = Q − 1 {\displaystyle Q^{\dagger }=Q^{-1}} ). If A has n linearly independent columns, then the first n columns of Q form an orthonormal basis for the column space of A. More generally, the first k columns of Q form an orthonormal basis for the span of the first k columns of A for any 1 ≤ k ≤ n. The fact that any column k of A only depends on the first k columns of Q corresponds to the triangular form of R.

Rectangular matrix More generally, we can factor a complex m×n matrix A, with m ≥ n, as the product of an m×m unitary matrix Q and an m×n upper triangular matrix R. As the bottom (m−n) rows of an m×n upper triangular matrix consist entirely of zeroes, it is often useful to partition R, or both R and Q:

A = Q R = Q [ R 1 0 ] = [ Q 1 Q 2 ] [ R 1 0 ] = Q 1 R 1 , {\displaystyle A=QR=Q{\begin{bmatrix}R_{1}\\0\end{bmatrix}}={\begin{bmatrix}Q_{1}&Q_{2}\end{bmatrix}}{\begin{bmatrix}R_{1}\\0\end{bmatrix}}=Q_{1}R_{1},}

where R1 is an n×n upper triangular matrix, 0 is an (m − n)×n zero matrix, Q1 is m×n, Q2 is m×(m − n), and Q1 and Q2 both have orthogonal columns. Golub & Van Loan (1996, §5.2) call Q1R1 the thin QR factorization of A; Trefethen and Bau call this the reduced QR factorization. If A is of full rank n and we require that the diagonal elements of R1 are positive then R1 and Q1 are unique, but in general Q2 is not. R1 is then equal to the upper triangular factor of the Cholesky decomposition of A* A (= ATA if A is real).

QL, RQ and LQ decompositions Analogously, we can define QL, RQ, and LQ decompositions, with L being a lower triangular matrix.

Computing the QR decomposition There are several methods for actually computing the QR decomposition, such as the Gram–Schmidt process, Householder transformations, or Givens rotations. Each has a number of advantages and disadvantages.

Using the Gram–Schmidt process

Consider the Gram–Schmidt process applied to the columns of the full column rank matrix A = [ a 1 ⋯ a n ] {\displaystyle A={\begin{bmatrix}\mathbf {a} _{1}&\cdots &\mathbf {a} _{n}\end{bmatrix}}} , with inner product ⟨ v , w ⟩ = v T w {\displaystyle \langle \mathbf {v} ,\mathbf {w} \rangle =\mathbf {v} ^{\textsf {T}}\mathbf {w} } (or ⟨ v , w ⟩ = v † w {\displaystyle \langle \mathbf {v} ,\mathbf {w} \rangle =\mathbf {v} ^{\dagger }\mathbf {w} } for the complex case). Define the projection:

… excerpt ends here. Continue reading the full article.

Illustrations

QR decomposition: Geometric interpretation of the QR decomposition in three dimensions, illustrating the structure of the factorization as an upper triangular transformation followed by an orthogonal transformation.
Geometric interpretation of the QR decomposition in three dimensions, illustrating the structure of the factorization as an upper triangular transformation followed by an orthogonal transformation.
QR decomposition: Householder reflection for QR-decomposition: The goal is to find a linear transformation that changes the vector 
  
    
      
        
          x
        
      
    
    {\displaystyle \mathbf {x} }
  
 into a vector of the same length which is collinear to 
  
    
      
        
          
            e
          
          
            1
          
        
      
    
    {\displaystyle \mathbf {e} _{1}}
  
. We could use an orthogonal projection (Gram-Schmidt) but this will be numerically unstable if the vectors 
  
    
      
        
          x
        
      
    
    {\displaystyle \mathbf {x} }
  
 and 
  
    
      
        
          
            e
          
          
            1
          
        
      
    
    {\displaystyle \mathbf {e} _{1}}
  
 are close to orthogonal. Instead, the Householder reflection reflects through the dotted line (chosen to bisect the angle between 
  
    
      
        
          x
        
      
    
    {\displaystyle \mathbf {x} }
  
 and 
  
    
      
        
          
            e
          
          
            1
          
        
      
    
    {\displaystyle \mathbf {e} _{1}}
  
). The maximum angle with this transform is 45 degrees.
Householder reflection for QR-decomposition: The goal is to find a linear transformation that changes the vector x {\displaystyle \mathbf {x} } into a vector of the same length which is collinear to e 1 {\displaystyle \mathbf {e} _{1}} . We could use an orthogonal projection (Gram-Schmidt) but this will be numerically unstable if the vectors x {\displaystyle \mathbf {x} } and e 1 {\displaystyle \mathbf {e} _{1}} are close to orthogonal. Instead, the Householder reflection reflects through the dotted line (chosen to bisect the angle between x {\displaystyle \mathbf {x} } and e 1 {\displaystyle \mathbf {e} _{1}} ). The maximum angle with this transform is 45 degrees.

Worked examples

Example 1 — a first encounter with QR decomposition

Start with the simplest possible case. Write down what QR decomposition claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to QR decomposition before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about QR decomposition ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of QR decomposition

In research
QR decomposition appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses QR decomposition in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
QR decomposition is common in secondary-school and first-year university syllabi. It links to neighbouring topics Matrix decompositions, Numerical linear algebra, so understanding it makes those chapters shorter.
In everyday life
Look for QR decomposition outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study QR decomposition in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what QR decomposition means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain QR decomposition out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is QR decomposition in simple terms?

In linear algebra, a QR decomposition, also known as a QR factorization or QU factorization, is a decomposition of a matrix A into a product A = QR of an orthonormal matrix Q and an upper triangular matrix R. QR decomposition is often used to solve the linear least squares (LLS) problem and is the…

Why does QR decomposition matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study QR decomposition?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on QR decomposition.

Tags

  • Matrix decompositions
  • Numerical linear algebra

Keep exploring