# inverse

Laurent matrix inverse

Since R2021b

## Syntax

``R = inverse(M)``

## Description

example

````R = inverse(M)` returns the inverse of the Laurent matrix `M` if `M` has a nonzero monomial determinant.```

## Examples

collapse all

Create the Laurent polynomials:

• $a\left(z\right)=z+1$

• $b\left(z\right)={z}^{2}+z+{z}^{-1}$

• $c\left(z\right)=z$

• $d\left(z\right)={z}^{2}+{z}^{-1}$

```lpA = laurentPolynomial(Coefficients=[1 1],MaxOrder=1); lpB = laurentPolynomial(Coefficients=[1 1 0 1],MaxOrder=2); lpC = laurentPolynomial(Coefficients=[1],MaxOrder=1); lpD = laurentPolynomial(Coefficients=[1 0 0 1],MaxOrder=2);```

Create the matrix `lmat` = $\left[\begin{array}{cc}\mathit{a}\left(\mathit{z}\right)& \mathit{b}\left(\mathit{z}\right)\\ \mathit{c}\left(\mathit{z}\right)& \mathit{d}\left(\mathit{z}\right)\end{array}\right]$. Obtain the determinant of `lmat`.

```lmat = laurentMatrix(Elements={lpA,lpB;lpC,lpD}); det(lmat)```
```ans = laurentPolynomial with properties: Coefficients: 1 MaxOrder: -1 ```

The determinant is a nonzero monomial. Obtain the inverse of `lmat`. Inspect the elements of the inverse.

```lmatinv = inverse(lmat); lmatinv.Elements{1,1}```
```ans = laurentPolynomial with properties: Coefficients: [1 0 0 1] MaxOrder: 3 ```
`lmatinv.Elements{1,2}`
```ans = laurentPolynomial with properties: Coefficients: [-1 -1 0 -1] MaxOrder: 3 ```
`lmatinv.Elements{2,1}`
```ans = laurentPolynomial with properties: Coefficients: -1 MaxOrder: 2 ```
`lmatinv.Elements{2,2}`
```ans = laurentPolynomial with properties: Coefficients: [1 1] MaxOrder: 2 ```

Confirm the product of `lmat` and its inverse is equal to the identity matrix.

```matprod = lmat*lmatinv; matprod.Elements{1,1}```
```ans = laurentPolynomial with properties: Coefficients: 1 MaxOrder: 0 ```
`matprod.Elements{1,2}`
```ans = laurentPolynomial with properties: Coefficients: 0 MaxOrder: 0 ```
`matprod.Elements{2,1}`
```ans = laurentPolynomial with properties: Coefficients: 0 MaxOrder: 0 ```
`matprod.Elements{2,2}`
```ans = laurentPolynomial with properties: Coefficients: 1 MaxOrder: 0 ```

## Input Arguments

collapse all

Laurent matrix, specified as a `laurentMatrix` object.

## Output Arguments

collapse all

Inverse of a Laurent matrix, returned as a `laurentMatrix` object.

## Version History

Introduced in R2021b