# LU decomposition (for TI compatibility): LU

### 5.49.6 LU decomposition (for TI compatibility): LU

The LU command finds the LU decomposition of a matrix.

- LU takes four arguments:
  - A, a numeric square matrix.
  - l,u and p, three variable names.
- LU(A) returns the matrix P from the LU decomposition of A, and assigns L, U and P to the variables l,u and p. Namely, P is a permutation matrix, L is lower triangular with 1s on the diagonal, and U is upper triangular with PA=LU.

#### Example.

Input:

LU([[3,5],[4,5]],L,U,P)

Output:

⎡
⎢
⎣

1 | 0
0 | 1

⎤
⎥
⎦

[[0,1],[1,0]]

Input:

L

Output:

⎡
⎢
⎢
⎢
⎢
⎣

1 | 0

4
3

1

⎤
⎥
⎥
⎥
⎥
⎦

Input:

U

Output:

⎡
⎢
⎢
⎢
⎢
⎣

3 | 5

0

−

5
3

⎤
⎥
⎥
⎥
⎥
⎦

Input:

P

Output:

⎡
⎢
⎣

1 | 0
0 | 1

⎤
⎥
⎦