## § Operations with modular fractions

• Quick note on why it's legal to perform regular arithmetic operations on fractions $a/b$ as operations on $ab^{-1}$ where $ab^{-1} \in \mathbb Z/pZ$.
• The idea is that we wish to show that the map $a/b \mapsto ab^{-1}$ is a ring homomorphism $\phi: \mathbb Q \to \mathbb Z/p \mathbb Z$.
• The proof: (i) the map $Z \rightarrow Z/pZ$ is a ring homormophism, (ii) map from an integral domain to a field always factors through the field of fractions of the domain, we get a map $\phi: \mathbb Q \rightarrow \mathbb Z/ p \mathbb Z$. So from abstract nonsense, we see that $\phi$ will be a well defined ring.hom.
• More down to earth: let's check addition multiplication, and multiplicative inverse. All else should work automagically.
• For addition, we wish to show that $\phi(a/b + c/d) = \phi(a/b) + \phi(c/d)$. Perform the calculation:
\begin{aligned} &\phi(a/b + c/d) \\ &=\phi((ad + bc)/bd) \\ &= (ad + bc)(bd)^{-1}\\ &= abb^{-1}d^{-1} + bcb^{-1}d^{-1} \\ &= ad^{-1} + cd^{-1} \\ &= \phi{a/d} + \phi{c/d} \\ \end{aligned}
• For multiplication, we wish to show that $\phi(a/b \cdot c/d) = \phi(a/b) \cdot \phi(c/d)$:
\begin{aligned} &\phi(a/b \cdot c/d) \\ &=\phi{ac/bd} &= ac(bd)^{-1} \\ &= acd^{-1}b^{-1} \\ &= ab^{-1} \cdot cd^{-1} \\ &= \phi{a/b} \cdot \phi{c/d} \\ \end{aligned}
• For inverse, we wish to show that $\phi(1/(a/b)) = \phi(a/b)^{-1}$:
\begin{aligned} &\phi(1/(a/b)) &=\phi{b/a} &= ba^{-1} &= (ab^{-1})^{-1} &= \phi(a/b)^{-1} \end{aligned} Thus, we can simply represent terms $a/b$ in terms of $ab^{-1}$ and perform arithmetic as usual.