What is the meaning of modular fractions?

Recall $b$ is invertible mod $n\iff b$ is coprime to $n\ $ [by Bezout's identity for $\,\gcd(b,n)=1$]

When so we define $\ a/b := ab^{-1},\,$ which is the unique solution of $\,bx\equiv a\pmod{\!n}$

Hence $\ a/b = ab^{-1}\equiv c \iff a\equiv bc\pmod{\!n}.\ $ Operationally $\,\ a/b\bmod n\, :=\, ab^{-1}\bmod n$

We can do modular fraction arithmetic on all rationals writable with denominator coprime to $n$ (which comprise a subring of the rationals, i.e. are closed under addition and multiplication). The well-known formulas for fraction addition and multiplication remain true for modular fractions, e.g. the addition law $\,a/b+c/d = (ad+bc)/(bd)\,$ holds true because $$\,(ad+bc)\color{#0a0}{(bd)^{-1}}\!\equiv ad\,\color{#0a0}{d^{-1}b^{-1}}+ \color{#0a0}{d^{-1}b^{-1}}bc\equiv ab^{-1}+d^{-1}b $$

See here for many examples of modular fraction arithmetic.

Beware $\ $ Modular fraction arithmetic is well-defined only for fractions with denominator coprime to the modulus. See here for further discussion.

Remark $ $ You may already be familiar with this idea from calculus. For example, consider polynomials with real coefficients. Every real $r\neq 0$ is invertible so we can work with fractional expressions $f(x)/r := r^{-1} f(x)\,$ just as above. Then $\,f/r+g/s = (sf\!+\!rg)/(rs),\,$ and $\,(f/r)(g/s) = fg/(rs).\,$ More generally the same idea works for invertible elements in any commutative domain (e.g. we can work with "compound fractions" of rationals, reals, or elements of any field). These ideas are algebraically reified in university algebra when one studies fraction fields and localizations of rings and modules which - unlike the degenerate cases above - typically enlarge the domain by adjoining inverses of non-invertible elements.


The first one means $$ kn \equiv m \pmod{l} . $$ The second is a name for the solution to the congruence $$ n \times ? \equiv m \pmod{l} . $$ That congruence has a unique solution when $l$ and $n$ are relatively prime.