Inverse of a matrix in ℤ/pℤ: Inverse

### 6.35.6 Inverse of a matrix in ℤ/pℤ: Inverse

In Xcas mode, Inverse is simply the inert form of inverse; namely, it gives the inverse of a matrix without evaluating it. (See section Section 6.47.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 one argument:
  A, a matrix with elements in ℤ/pℤ.
- Det(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])

Output:

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

To get the actual inverse, you can enter:
Input:

eval(ans())

Output:

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ |
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

Output:

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