### 11.9.6 Inverse of a matrix in ℤ/pℤ

In Xcas mode, Inverse is simply the inert form of inverse; namely, it gives the inverse of a matrix without evaluating it. (See Section 15.1.2.) In Maple mode, the Inverse command can additionally be used in conjunction with mod to find the inverse of a matrix whose elements are in ℤ/pℤ.

- In Maple mode, Inverse takes A, a matrix with elements in ℤ/pℤ.
- Inverse(A) returns the inverse of A.

#### Example

Input in Xcas mode:

Inverse([[1,2,9] mod 13,[3,10,0] mod 13,[3,11,1] mod13])

inverse | ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ |  |
⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ |
1%13 | 2%13 |
⎛ ⎝ | −4 | ⎞ ⎠ | %13
3%13 |
⎛ ⎝ | −3 | ⎞ ⎠ | %13
| 0%13
3%13 |
⎛ ⎝ | −2 | ⎞ ⎠ | %13
| 1%13
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦
|  | ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠

To get the actual inverse, enter:

eval(ans())

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ |
2%13 |
⎛ ⎝ | −4 | ⎞ ⎠ | %13
⎛ ⎝ | −5 | ⎞ ⎠ | %13
2%13 | 0%13 |
⎛ ⎝ | −5 | ⎞ ⎠ | %13
| ⎛ ⎝ | −2 | ⎞ ⎠ | %13
⎛ ⎝ | −1 | ⎞ ⎠ | %13
| 6%13
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦

which is the inverse of A=[[1,2,9],[3,10,0],[3,11,1]] in ℤ/13ℤ.

Input in Maple mode:

Inverse([[1,2,9],[3,10,0],[3,11,1]]) mod 13

⎡ ⎢ ⎢ ⎣ |
2 | −4 | −5
2 | 0 | −5
−2 | −1 | 6
| ⎤ ⎥ ⎥ ⎦