Field is a Set# \(S\), together with two operations \(+\) and \(*\), which has the following properties including those in #Group, #Abelian Group, #Ring, #Communicative Ring, and #Integral Domain:
- Multiplicative inverse, which means If \(a \in S\) and \(a \not = 0\), \(\exist a^{-1} \in S, aa^{-1} = a^{-1}a = 1\)
In Modular Arithmetic#, the find the multiplicative inverse of a number \(a\) is by the equation, where \(a\) is relatively prime to \(n\):
$$ \begin{align} a * x &\equiv 1 (\mod n) \text{ , or} \\ ax + bn &= 1 \end{align} $$
From here, we could also know that:
$$ a \equiv x^{-1} (\mod n) $$
Thus found the inverse of \(a\) in modular sense. To do that, we utilises the Euclidean Algorithm# and extends its steps on \(a \mod n\) as follows:
- Do one round of Euclidean Algorithm on the modulo.
- Apply the properties \(a = qn + b\), transform it to \(b = a - qn\).
- If \(b\) is 0, we can conclude that \(a\) is not relatively prime to \(n\), which means there is no solution for it. Otherwise, continue.
- If \(b\) is 1, substitutes accordingly using the equations generated in step 2.
- Utilise the property where \(n \mod n = 0\), produce an equation resembles \(1 = a * x (\mod n)\).
- Reconstruct the equation to \(a^{-1} = x (\mod n)\) which is identical to \(a = x^{-1} (\mod n)\), thus found the solution.
Note: If \(n\) is a prime number, then every number from \(1\) to \(n - 1\) is relatively prime to \(n\) and has an exactly one inverse modulo \(n\) in the range.
Note: We could check the answer by determining whether \(xa^{-1} \mod n = 1\). If yes, then the answer is correct.
Or we could instead use multiplicative table# or trial and error by using the formulae \(a^{-1} \times x = 1 \mod 5\) to find out the answer.