# lu

LU factorization

## Syntax

## Description

`[L,U] = lu(`

returns an upper triangular
matrix `A`

)`U`

and a matrix `L`

, such that ```
A =
L*U
```

. Here, `L`

is a product of the inverse of the permutation
matrix and a lower triangular matrix.

`[L,U,P] = lu(`

returns an upper triangular
matrix `A`

)`U`

, a lower triangular matrix `L`

, and a
permutation matrix `P`

, such that `P*A = L*U`

. The
syntax `lu(A,'matrix')`

is identical.

`[L,U,p] = lu(`

returns the permutation information as a vector `A`

,`'vector'`

)`p`

, such that
`A(p,:) = L*U`

.

`[L,U,p,q] = lu(`

returns the permutation information as two row vectors `A`

,`'vector'`

)`p`

and
`q`

, such that `A(p,q) = L*U`

.

`[L,U,P,Q,R] = lu(`

returns an upper
triangular matrix `A`

)`U`

, a lower triangular matrix `L`

,
permutation matrices `P`

and `Q`

, and a scaling matrix
`R`

, such that `P*(R\A)*Q = L*U`

. The syntax
`lu(A,'matrix')`

is identical.

`[L,U,p,q,R] = lu(`

returns the permutation information in two row vectors `A`

,`'vector'`

)`p`

and
`q`

, such that `R(:,p)\A(:,q) = L*U`

.

`lu(`

returns the matrix that contains the
strictly lower triangular matrix `A`

)`L`

(the matrix without its unit
diagonal) and the upper triangular matrix `U`

as submatrices. Thus,
`lu(A)`

returns the matrix `U + L - eye(size(A))`

, where
`L`

and `U`

are defined as ```
[L,U,P] =
lu(A)
```

. The matrix `A`

must be square.

## Examples

## Input Arguments

## More About

## Tips

Calling

`lu`

for numeric arguments that are not symbolic objects invokes the MATLAB^{®}`lu`

function.The

`thresh`

option supported by the MATLAB`lu`

function does not affect symbolic inputs.If you use

`'matrix'`

instead of`'vector'`

, then`lu`

returns permutation matrices, as it does by default.`L`

and`U`

are nonsingular if and only if`A`

is nonsingular.`lu`

also can compute the LU factorization of a singular matrix`A`

. In this case,`L`

or`U`

is a singular matrix.Most algorithms for computing LU factorization are variants of Gaussian elimination.

## Version History

**Introduced in R2013a**