# linalg::inverseLU

Computing the inverse of a matrix using LU-decomposition

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```linalg::inverseLU(`A`)
linalg::inverseLU(`L`, `U`, `pivindex`)
```

## Description

`linalg::inverseLU(A)` computes the inverse of the square matrix A using LU-decomposition.

`linalg::inverseLU(L, U, pivindex)` computes the inverse of the matrix A = P- 1LU where `L`, `U` and `pivindex` are the result of an LU-deomposition of the (nonsingular) Matrix A, as computed by `linalg::factorLU`.

The matrix `A` must be nonsingular.

`pivindex` is a list ```[r[1], r[2], ...]``` representing a permutation matrix P such that B = PA = LU, where bij = ari, j.

It is not checked whether `pivindex` has such a form.

The component ring of the input matrices must be a field, i.e., a domain of category `Cat::Field`.

## Examples

### Example 1

We compute the inverse of the matrix:

```A := Dom::Matrix(Dom::Real)( [[2, -3, -1], [1, 1, -1], [0, 1, -1]] )```

using LU-decomposition:

`Ai := linalg::inverseLU(A)`

We check the result:

`A * Ai, Ai * A`

We can also compute the inverse of A in the usual way:

`1/A`

`linalg::inverseLU` should be used for efficiency reasons in the case where an LU decomposition of a matrix already is computed, as the next example illustrates.

### Example 2

If we already have an LU decomposition of a (nonsingular) matrix, we can compute the inverse of the matrix A = P- 1LU as follows:

`LU := linalg::factorLU(linalg::hilbert(3))`

`linalg::inverseLU(op(LU))`

`linalg::inverseLU` then only needs to perform forward and backward substitution to compute the inverse matrix (see also `linalg::matlinsolveLU`).

## Parameters

 `A`, `L`, `U` A square matrix of a domain of category `Cat::Matrix` `pivindex` A list of positive integers

## Return Values

Matrix of the same domain type as `A` or `L`, respectively.