Reciprocals in modular arithmetic [01EY]
- October 28, 2026
- Marcelo Fiore, Jon Sterling
Corollary Linear coefficients of the gcd and reciprocals of modular integers [01EZ]
- October 28, 2026
- Marcelo Fiore, Jon Sterling
For all positive integers m and n,
- n\cdot \operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}} \equiv \gcd {\mathopen {}\left (m,n\right )\mathclose {}}\mod m, and
- whenever m and n are coprime (i.e. \gcd {\mathopen {}\left (m,n\right )\mathclose {}}=1), the modular normal form {\mathopen {}\left [\operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\right ]\mathclose {}}_m is the reciprocal of {\mathopen {}\left [n\right ]\mathclose {}}_m in \mathbb {Z}_m.
After attempting to prove this yourself, you may click this text to see my proof.
Proof.
- October 28, 2026
- Marcelo Fiore, Jon Sterling
The first proposition is seen to hold by definition. Indeed: \gcd {\mathopen {}\left (m,n\right )\mathclose {}} = \operatorname {lc}_1{\mathopen {}\left (m,n\right )\mathclose {}}\cdot m+\operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\cdot n so we have \gcd {\mathopen {}\left (m,n\right )\mathclose {}} - \operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\cdot n = \operatorname {lc}_1{\mathopen {}\left (m,n\right )\mathclose {}}\cdot m and hence m \mid {\mathopen {}\left ( \gcd {\mathopen {}\left (m,n\right )\mathclose {}} - n\cdot \operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\right )\mathclose {}} which is identical to the claim by definition of congruence.
For the second proposition, we assume \gcd {\mathopen {}\left (m,n\right )\mathclose {}} = 1 and we must prove {\mathopen {}\left [\operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\right ]\mathclose {}}_m \cdot _m {\mathopen {}\left [n\right ]\mathclose {}}_m = 1 which is equivalent to \operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\cdot n \equiv 1\mod m and, by assumption, to \operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\cdot n \equiv \gcd {\mathopen {}\left (m,n\right )\mathclose {}}\mod m\text {.}
By definition, we must show that m\mid {\mathopen {}\left (\gcd {\mathopen {}\left (m,n\right )\mathclose {}}-\operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\cdot n\right )\mathclose {}}, which is immediate because \gcd {\mathopen {}\left (m,n\right )\mathclose {}}-\operatorname {lc}_2{\mathopen {}\left (m,n\right )\mathclose {}}\cdot n = \operatorname {lc}_1{\mathopen {}\left (m,n\right )\mathclose {}}\cdot m.
Remark Reciprocals in the modular integers [01F1]
- October 28, 2026
- Marcelo Fiore, Jon Sterling
For every pair of positive integers m and n, the modular normal form {\mathopen {}\left [n\right ]\mathclose {}}_m has a reciprocal in the modular integers \mathbb {Z}_m if and only if m and n are coprime.