## What is QR Decomposition?

**A = QR**. In the formula,

**A**represents the starting matrix,

**Q**

represents an orthogonal matrix, and

**R**represents an upper triangle matrix. An upper triangle matrix is a special kind of square matrix in which all of the entries below the main diagonal are zero. Often, QR decomposition is used in solving the linear least squares problem.

## How does QR Decomposition work?

There are in fact a couple of methods to compute a QR decomposition. These include the the Gram–Schmidt process, Householder transformations, and Givens rotations. Each has a number of advantages and disadvantages. In essence, the QR decomposition takes a square or rectangular matrix and decomposes it into the two units,

**Q**and

**R**. By breaking down these matrices, they become easier to work with in other capacities, expanding the applicability of a given function.

### QR Decomposition and Machine Learning

QR decomposition can be useful in machine learning applications. An example of using QR decomposition in machine learning is the automatic removal of an object from an image. Imagine wanting to crop the image of a car from a video clip. Using what is known as single value decomposition, it becomes relatively simple. In short, by splitting the video into its individual frames, turning the frames into 1D vectors, and creating a matrices of the vectors corresponding to each image, one can then run a single value decomposition on the video. The decomposition allows for a simple separation of foreground objects from a background space within images from a video.