# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

## Compute QR Factorization

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

The QR factorization expresses an m×n matrix `A` as follows: `A = Q*R`. Here `Q` is an m×m unitary matrix, and `R` is an m×n upper triangular matrix. If the components of `A` are real numbers, `Q` is an orthogonal matrix. To compute the QR decomposition of a matrix, use the `linalg::factorQR` function. For example, compute the QR decomposition of the 3×3 Pascal matrix:

```P := linalg::pascal(3): [Q, R] := linalg::factorQR(P)```
``` ```

The product of `Q` and `R` gives the original 3×3 Pascal matrix:

`testeq(P = Q*R)`
``` ```

Also, you can perform the QR factorization for matrices that contain complex values. In this case, the matrix `Q` is unitary:

```B := matrix([[I, -1], [1, I]]): [Q, R] := linalg::factorQR(B)```
``` ```

Again, the product of `Q` and `R` gives the original matrix `B`:

`testeq(B = Q*R)`
``` ```