# schur

Schur decomposition

## Syntax

``T = schur(A)``
``T = schur(A,mode)``
``[U,T] = schur(___)``

## Description

example

````T = schur(A)` returns the Schur matrix of `A`.```

example

````T = schur(A,mode)`, if `A` is a real matrix, returns a real quasitriangular Schur matrix if `mode` is `"real"` or returns a complex triangular Schur matrix if `mode` is `"complex"`. If `A` is a complex matrix, then `schur` returns the complex Schur form regardless of the value of `mode`.```

example

````[U,T] = schur(___)` also returns a unitary matrix `U` such that `A = U*T*U'`.```

## Examples

collapse all

Create a 3-by-3 matrix and calculate its Schur form. The result is a matrix with the eigenvalues of `A` (which are `1`, `2`, and `3`) on the diagonal.

```A = [-149 -50 -154; 537 180 546; -27 -9 -25]; T = schur(A)```
```T = 3×3 1.0000 -7.1119 815.8706 0 2.0000 55.0236 0 0 3.0000 ```

The large off-diagonal elements indicate that this matrix has poorly conditioned eigenvalues, which can be confirmed by finding the condition numbers using the `condeig` function.

`condeig(A)`
```ans = 3×1 603.6390 395.2366 219.2920 ```

Create a 3-by-3 matrix with complex eigenvalues.

`A = [3 1 1; 0 2 0; -2 1 1]`
```A = 3×3 3 1 1 0 2 0 -2 1 1 ```

Calculate the real Schur form of `A`. The 2-by-2 block matrix on the diagonal represents a pair of conjugate complex eigenvalues.

`T1 = schur(A)`
```T1 = 3×3 2.0000 0.3820 1.3764 -2.6180 2.0000 0.3249 0 0 2.0000 ```

Find the eigenvalues of the real Schur form using the `ordeig` function.

`ordeig(T1)`
```ans = 3×1 complex 2.0000 + 1.0000i 2.0000 - 1.0000i 2.0000 + 0.0000i ```

Calculate the complex Schur form of `A` by specifying `mode` as `"complex"`. The diagonal values of `T2` are the eigenvalues of the Schur form of `A`, which are the same as the output of `ordeig`.

`T2 = schur(A,"complex")`
```T2 = 3×3 complex 2.0000 + 1.0000i 2.2361 + 0.0000i -0.3035 - 0.4911i 0.0000 + 0.0000i 2.0000 - 1.0000i 1.2858 + 0.1159i 0.0000 + 0.0000i 0.0000 + 0.0000i 2.0000 + 0.0000i ```

Create a 3-by-3 magic square matrix and calculate its Schur decomposition factors.

```A = magic(3); [U,T] = schur(A)```
```U = 3×3 -0.5774 -0.8131 -0.0749 -0.5774 0.4714 -0.6667 -0.5774 0.3416 0.7416 ```
```T = 3×3 15.0000 0.0000 -0.0000 0 4.8990 -3.4641 0 0 -4.8990 ```

Verify that the norms of `A-U*T*U'` and `U'*U - eye(size(U))` are 0, within machine precision.

`norm(A-U*T*U')`
```ans = 6.7711e-15 ```
`norm(U'*U - eye(size(U)))`
```ans = 5.0471e-16 ```

## Input Arguments

collapse all

Input matrix, specified as a real or complex square matrix. `A` must be dense.

Data Types: `single` | `double`
Complex Number Support: Yes

Schur form system, specified as `"real"` or `"complex"`.

• If `A` is real, then `mode` can be `"real"` or `"complex"`. If `mode` is `"real"`, then `schur` returns real quasitriangular `T`. If `mode` is `"complex"`, then `schur` returns complex triangular `T`.

• If `A` is complex, then `schur` ignores `mode` and returns the complex Schur form, which is upper triangular with the eigenvalues of `A` on the diagonal.

## Output Arguments

collapse all

Schur vectors, returned as a unitary matrix that satisfies ```A = U*T*U'```. Each column of `U` corresponds to a Schur vector. If the Schur matrix `T` is triangular, then the first column of `U` is an eigenvector of `A` corresponding to the first element of `T`.

Schur matrix, returned as a real or complex square matrix. If `mode` is `"complex"`, then `T` is triangular. If `mode` is `"real"`, then `T` is quasitriangular.

collapse all

### Quasitriangular Matrix

An upper quasitriangular matrix can result from the Schur decomposition or generalized Schur (QZ) decomposition of a real matrix. An upper quasitriangular matrix is block upper triangular, with 1-by-1 and 2-by-2 blocks of nonzero values along the diagonal.

The eigenvalues of these diagonal blocks are also the eigenvalues of the matrix. The 1-by-1 blocks correspond to real eigenvalues, and the 2-by-2 blocks correspond to complex conjugate eigenvalue pairs.

### Unitary Matrix

An invertible complex square matrix `U` is unitary if its conjugate transpose is also its inverse, that is, if ${U}^{*}U=U{U}^{*}=I$.

## Tips

• You can use the `rsf2csf` function to convert the real Schur form of a matrix to its complex Schur form. `[U,T] = rsf2csf(A)` returns the same outputs as `[U,T] = schur(A,"complex")`.

## Version History

Introduced before R2006a