Modular Inverse of a Matrix

I have a 3 x 3 matrix M , I'm trying to find the inverse M mod (101). I currently know I can do this by finding M inverse and using x from Diophantine as a scalar and then taking mod 101 of each value (https://www.youtube.com/watch?v=LhBovzm4Ajs&t=2s). I'm having problems determining x by hand, so is there a different approach ?
Wolfram shows that it can be done with the function I'm just not understanding the notation

• You seem to say that while $M$ is a $3\times 3$ matrix, its inverse depends on "using $x$ from Diophantine as a scaler (scalar?)". But the inverse of $M$ mod $101$ will again be a $3\times 3$ matrix if it exists. – hardmath Feb 11 '17 at 17:11
• yes, im trying to find the inverse matrix mod n, in the example posted the inverse is taken, then scaled with diophantine value, then the mod of each value is used to make the inverse matrix mod n. I'm wondering if there's a different approach such as using the adjoint and determinant, ect. – guy_sensei Feb 11 '17 at 17:17

It's a field. This means you put your matrix and a copy of the identity matrix side by side. Then use elementary row operations to take the left square to the identity matrix; this will require finding modular inverse of several numbers. However, once those numbers are found, doing the matrix operations is not bad, just keep reducing $\pmod {101}$ every time you do something. Let me think of a 2 by 2 example...
$$\left( \begin{array}{rrrr} 5 & 3 & 1 & 0 \\ -3 & 5 & 0 & 1 \end{array} \right)$$ $$\frac{1}{5} \equiv -20 \equiv 81 \pmod {101}$$ mult first row by 81. $$\left( \begin{array}{rrrr} 405 & 243 & 81 & 0 \\ -3 & 5 & 0 & 1 \end{array} \right)$$ reduce mod 101. $$\left( \begin{array}{rrrr} 1 & 41 & 81 & 0 \\ -3 & 5 & 0 & 1 \end{array} \right)$$ add three times row one to row 2 $$\left( \begin{array}{rrrr} 1 & 41 & 81 & 0 \\ 0 & 128 & 243 & 1 \end{array} \right)$$ $$\left( \begin{array}{rrrr} 1 & 41 & 81 & 0 \\ 0 & 27 & 41 & 1 \end{array} \right)$$ $$\frac{1}{27} \equiv 15 \pmod {101}$$ second row by 15 $$\left( \begin{array}{rrrr} 1 & 41 & 81 & 0 \\ 0 & 1 & 9 & 15 \end{array} \right)$$ add 60 times second to first $$\left( \begin{array}{rrrr} 1 & 0 & 15 & 92 \\ 0 & 1 & 9 & 15 \end{array} \right)$$ so thats it, inverse is $$\left( \begin{array}{rr} 15 & 92 \\ 9 & 15 \end{array} \right)$$