In $\mathbb{Z}_{21}$, the equation $10x = 1$ has a solution: $10 \cdot 19 = 190 = 21 \cdot 9 + 1$, so $x = 19$ works, and dividing by 10 in $\mathbb{Z}_{21}$ means multiplying by 19. The equation $14x = 1$ has none. Worse, $14 \cdot 3 = 42 = 0$ in $\mathbb{Z}_{21}$: two nonzero elements multiply to zero. In $\mathbb{Z}_{13}$ neither problem arises. Which classes can we divide by, and what makes 13 behave so differently from 21?
An element with a multiplicative inverse is a unit, and a nonzero element that multiplies some nonzero element to zero is a zero divisor. The trouble with 14 can be seen directly: every multiple of 14 is a multiple of 7, and stays one after subtracting multiples of 21, so the multiples of 14 in $\mathbb{Z}_{21}$ are only $0$, $7$ and $14$. The multiplication table of $\mathbb{Z}_{13}$, by contrast, has exactly one 1 in every nonzero row. A single condition separates the two cases, whether $a$ and $n$ have a common factor, and Bezout's identity from the previous unit proves it and computes the inverses.
First we prove that $[a]$ is a unit exactly when $\gcd(a, n) = 1$, and compute an inverse in $\mathbb{Z}_{1729}$. Then we prove that every nonzero class is a unit or a zero divisor, never both, and that the prime moduli are exactly those with no zero divisors. Next we count the solutions of $ax = b$. Finally we see that the units form a group, and prove Wilson's theorem.
This is the last article of Congruence and Modular Arithmetic and covers §2.3 of the course text (Hungerford, 2014). It assumes the integers modulo $n$ and Bezout's identity. Throughout, $n \ge 2$, so that $[0] \neq [1]$, and elements of $\mathbb{Z}_n$ are written without brackets when the modulus is clear.
Units
Definition. An element $a$ of $\mathbb{Z}_n$ is a unit if there is an element $b$ of $\mathbb{Z}_n$ with $ab = 1$. Such a $b$ is a (multiplicative) inverse of $a$.
Multiplication in $\mathbb{Z}_n$ is commutative, so $ab = 1$ also gives $ba = 1$. An inverse, when it exists, is unique: if $ab = 1$ and $ac = 1$, then
$$b = b \cdot 1 = b(ac) = (ba)c = 1 \cdot c = c,$$
using associativity and commutativity. So the inverse can be named $a^{-1}$. In the integers the only units are $1$ and $-1$, since $ab = 1$ forces $\lvert a \rvert = 1$. In $\mathbb{Z}_{13}$ every nonzero element is a unit. In $\mathbb{Z}_{21}$, 10 is a unit with inverse 19, and 14 is not.
Which classes are units
Theorem. Let $n \ge 2$ and let $a$ be an integer. Then $[a]$ is a unit in $\mathbb{Z}_n$ if and only if $\gcd(a, n) = 1$.
Here is the idea: $au \equiv 1 \pmod n$ says that $au + nv = 1$ for some integer $v$, and by Bezout's identity 1 is a combination of $a$ and $n$ exactly when $\gcd(a, n) = 1$.
Proof. Suppose $\gcd(a, n) = 1$. By Bezout's identity there are integers $u$ and $v$ with
$$au + nv = 1.$$
Then $au - 1 = n(-v)$ is a multiple of $n$, so $au \equiv 1 \pmod n$, and $[a][u] = [au] = [1]$. So $[a]$ is a unit with inverse $[u]$.
Conversely, suppose $[a]$ is a unit, say $[a][b] = [1]$. Then $[ab] = [1]$, so $ab \equiv 1 \pmod n$, that is, $ab - 1 = nk$ for some integer $k$. Rearranged, $ab + n(-k) = 1$, which writes 1 as a linear combination of $a$ and $n$. By the corollary on relatively prime integers in the Euclidean algorithm article, $\gcd(a, n) = 1$. $\blacksquare$
The theorem is Hungerford's Theorem 2.9, restated in the language of units as Theorem 2.10, and Judson's Proposition 3.1.4(6). A side consequence is that $\gcd(a, n)$ depends only on the class of $a$. Two representatives $a$ and $a + nk$ of one class have the same common divisors with $n$, by the lemma behind the Euclidean algorithm. So the condition in the theorem does not depend on the representative chosen.
For $\mathbb{Z}_{21}$, with $21 = 3 \cdot 7$, the integers from 1 to 20 that are relatively prime to 21 are those divisible by neither 3 nor 7:
$$1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20.$$
These 12 classes are the units, and the script confirms that they are exactly the classes with an inverse. Their inverses pair them up: $2 \cdot 11 = 22 = 1$, $4 \cdot 16 = 64 = 1$, $5 \cdot 17 = 85 = 1$ and $10 \cdot 19 = 190 = 1$. The units 1, 8, 13 and 20 are their own inverses: $8 \cdot 8 = 64 = 1$, $13 \cdot 13 = 169 = 1$, and $20 = -1$.
Check your understanding. The pair $2 \cdot 11 = 1$ is listed above. Without searching, predict the inverse of $19 = -2$.
It is $-11 = 10$. As integers, $(-2)(-11) = 22$, the same product as $2 \cdot 11$, so $(-2)(-11) = 1$ in $\mathbb{Z}_{21}$, and indeed the list pairs 10 with 19: $10 \cdot 19 = 190 = 21 \cdot 9 + 1$. The same argument shows that the negative of every unit is a unit, with $(-a)^{-1} = -(a^{-1})$, and the script confirms it for all twelve units. In terms of factors, $-a$ and $a$ have the same prime factors, so $\gcd(-a, 21) = \gcd(a, 21)$.
Computing inverses
The proof is constructive: the inverse of $a$ is the coefficient $u$ in Bezout's identity, and the extended Euclidean algorithm computes it. To invert 100 in $\mathbb{Z}_{1729}$, run the algorithm on 1729 and 100, keeping each remainder as a combination $r_i = 1729\, s_i + 100\, t_i$. Each new row is the row two above minus $q_i$ times the row above:
| $i$ | $r_i$ | $s_i$ | $t_i$ | $q_i$ |
|---|---|---|---|---|
| 0 | 1729 | 1 | 0 | |
| 1 | 100 | 0 | 1 | 17 |
| 2 | 29 | 1 | $-17$ | 3 |
| 3 | 13 | $-3$ | 52 | 2 |
| 4 | 3 | 7 | $-121$ | 4 |
| 5 | 1 | $-31$ | 536 | 3 |
| 6 | 0 | 100 | $-1729$ |
Row 5 reads $1 = 1729 \cdot (-31) + 100 \cdot 536$. Modulo 1729 the first term vanishes, leaving $100 \cdot 536 \equiv 1$. So $100^{-1} = 536$ in $\mathbb{Z}_{1729}$. As a check, $100 \cdot 536 = 53{,}600 = 1729 \cdot 31 + 1$.
Only the $t$ column is needed. The algorithm takes as many steps as the Euclidean algorithm itself, which by Lamé's bound is at most five per decimal digit of the smaller number. Python computes the same inverse with pow(100, -1, 1729), which since version 3.8 accepts a negative exponent when the base is relatively prime to the modulus.
Zero divisors
The class 14 in $\mathbb{Z}_{21}$ had no inverse, and it also multiplied a nonzero class to zero. Is that a coincidence?
Definition. A nonzero element $a$ of $\mathbb{Z}_n$ is a zero divisor if there is a nonzero element $b$ of $\mathbb{Z}_n$ with $ab = 0$.
The integers have no zero divisors: a product of nonzero integers is nonzero. In $\mathbb{Z}_{21}$, $14 \cdot 3 = 42 = 0$, so 14 and 3 are both zero divisors. By convention 0 itself is not called a zero divisor, although $0 \cdot b = 0$ for every $b$. The term is meant to pick out nonzero elements that behave like 0 in some products.
For a composite example from the previous unit, recall that the Euclidean algorithm on 1729 and 1001 ended with the relation $1729 \cdot 11 = 1001 \cdot 19$. Read in $\mathbb{Z}_{1729}$, it says
$$1001 \cdot 19 = 0,$$
with both factors nonzero. The class 1001 is a zero divisor in $\mathbb{Z}_{1729}$, and $\gcd(1001, 1729) = 91$ is the reason. Since $19 = 1729/91$, multiplying 1001 by $1729/91$ produces $(1001/91) \cdot 1729$, a multiple of 1729.
Check your understanding. Is 728 a zero divisor in $\mathbb{Z}_{1729}$? Use $728 = 1729 - 1001$.
It is. In $\mathbb{Z}_{1729}$ the class 728 is $-1001$, so $728 \cdot 19 = -(1001 \cdot 19) = 0$, with the same partner 19. The gcd agrees: $\gcd(728, 1729) = 91$, as the script confirms.
Every nonzero class is one or the other
Theorem. Let $n \ge 2$. Every nonzero element of $\mathbb{Z}_n$ is either a unit or a zero divisor, and no element is both. Specifically, for $0 < a < n$, the class $a$ is a unit if $\gcd(a, n) = 1$ and a zero divisor if $\gcd(a, n) > 1$.
Here is the plan. When $\gcd(a, n) = d > 1$, multiplying $a$ by $n/d$ gives a multiple of $n$, as 1001 times 19 did. And a unit cannot be a zero divisor, because multiplying $ab = 0$ by $a^{-1}$ forces $b = 0$.
Proof. Let $0 < a < n$ and $d = \gcd(a, n)$. If $d = 1$, then $a$ is a unit by the previous theorem.
If $d > 1$, let $b = n/d$, an integer with $0 < b < n$, so $b$ is a nonzero class. Then
$$ab = a \cdot \frac{n}{d} = \frac{a}{d} \cdot n,$$
and $a/d$ is an integer, so $ab$ is a multiple of $n$ and $ab = 0$ in $\mathbb{Z}_n$. Since $a \neq 0$, it is a zero divisor.
No element is both. Suppose $a$ is a unit and $ab = 0$. Multiplying by $a^{-1}$,
$$b = 1 \cdot b = (a^{-1}a)b = a^{-1}(ab) = a^{-1} \cdot 0 = 0.$$
So the only $b$ with $ab = 0$ is $b = 0$, and $a$ is not a zero divisor. $\blacksquare$
In $\mathbb{Z}_{21}$ the zero divisors are therefore the eight nonzero classes divisible by 3 or 7, namely $3, 6, 7, 9, 12, 14, 15, 18$. The proof supplies the partner $n/d$ for each, for example $6 \cdot 7 = 42$, $9 \cdot 7 = 63$, $14 \cdot 3 = 42$, $15 \cdot 7 = 105$ and $18 \cdot 7 = 126$, all multiples of 21. The script checks the theorem for every $n$ up to 120. In $\mathbb{Z}_{1729}$, with $1729 = 7 \cdot 13 \cdot 19$, it counts 1,296 units and 432 zero divisors, which together make the 1,728 nonzero classes.
The dichotomy is special to finite rings such as $\mathbb{Z}_n$. In $\mathbb{Z}$, the integer 2 is neither a unit nor a zero divisor. In $\mathbb{Z}_n$ the finiteness forces the choice. If $a$ is not a zero divisor, then $ax = ay$ implies $a(x - y) = 0$, hence $x = y$. So the $n$ products $a \cdot 0, a \cdot 1, \ldots, a \cdot (n - 1)$ are all different. Then they are all $n$ elements of $\mathbb{Z}_n$ in some order, and one of them is 1. This is the reason each unit row of the table is a rearrangement of $0, 1, \ldots, 20$.
Prime moduli
Why does 13 behave so differently from 21? When $n$ is prime, every integer from 1 to $n - 1$ is relatively prime to $n$. The theorems above then say that every nonzero element is a unit. The converse holds too.
Theorem. Let $n \ge 2$. The following are equivalent.
- $n$ is prime.
- Every nonzero element of $\mathbb{Z}_n$ is a unit.
- $\mathbb{Z}_n$ has no zero divisors: whenever $ab = 0$ in $\mathbb{Z}_n$, $a = 0$ or $b = 0$.
Here is the plan: go around the cycle, and note that a factorization of a composite $n$ is itself a pair of zero divisors.
Proof. (1) implies (2). Let $n = p$ be prime and let $a$ be a nonzero element, represented by an integer with $0 < a < p$. Then $p \nmid a$, and since the only positive divisors of $p$ are 1 and $p$, $\gcd(a, p) = 1$. By the theorem on units, $a$ is a unit.
(2) implies (3). If every nonzero element is a unit, then no nonzero element is a zero divisor, since no element is both. So if $ab = 0$ and $a \neq 0$, then $b = 0$.
(3) implies (1). Suppose $n$ is not prime. Since $n \ge 2$, it factors as $n = rs$ with $1 < r < n$ and $1 < s < n$. Then $r$ and $s$ are nonzero elements of $\mathbb{Z}_n$, and $rs = n = 0$ in $\mathbb{Z}_n$. So $\mathbb{Z}_n$ has zero divisors, and (3) fails. $\blacksquare$
This is Hungerford's Theorem 2.8. The proof of (3) implies (1) here uses a factorization of $n$ directly; the course text argues instead through the characterization of primes by Euclid's lemma. The script checks the equivalence for every $n$ up to 200.
In the vocabulary of the next unit, the theorem says that $\mathbb{Z}_n$ is a field exactly when $n$ is prime. The fields $\mathbb{Z}_p$ are the first finite fields in the course. The construction of other finite fields, with $p^k$ elements, imitates them with polynomials in place of integers.
Cancellation
Ordinary algebra cancels nonzero factors. In $\mathbb{Z}_n$ a unit can be canceled: if $a$ is a unit and $ax = ay$, multiplying by $a^{-1}$ gives $x = y$. In $\mathbb{Z}_{21}$, $10 \cdot 4 = 40 = 19$ and $10 \cdot 25 = 250 = 19$, and canceling the unit 10 correctly concludes $4 = 25$, which is true since $25 - 4 = 21$. A zero divisor cannot be canceled: $14 \cdot 1 = 14$ and $14 \cdot 4 = 56 = 14$, but $1 \neq 4$. This is the rule for canceling in congruences from Congruence Modulo n, restated for classes. In $\mathbb{Z}_p$ every nonzero factor can be canceled.
Linear equations
Units settle the equation $ax = 1$. What about $ax = b$ for any $b$? In $\mathbb{Z}_n$ it is the linear congruence $ax \equiv b \pmod n$. If $a$ is a unit it has exactly one solution, $x = a^{-1}b$. In general the answer depends on $d = \gcd(a, n)$.
Theorem. Let $n \ge 2$, let $a$ and $b$ be integers, and let $d = \gcd(a, n)$. The equation $[a]x = [b]$ has a solution in $\mathbb{Z}_n$ if and only if $d \mid b$. In that case it has exactly $d$ solutions: if $x_0$ is one solution, the solutions are
$$x_0, \quad x_0 + \tfrac{n}{d}, \quad x_0 + 2\tfrac{n}{d}, \quad \ldots, \quad x_0 + (d - 1)\tfrac{n}{d}.$$
Here is the plan: $ax \equiv b \pmod n$ is the integer equation $ax + ny = b$, which the previous unit solved completely, so what remains is to count its solutions modulo $n$.
Proof. The class $[x]$ is a solution exactly when $ax \equiv b \pmod n$, that is, when $ax - b = n(-y)$ for some integer $y$, or
$$ax + ny = b.$$
So the solutions in $\mathbb{Z}_n$ are the classes of the integers $x$ that occur in integer solutions $(x, y)$ of this equation. By the theorem on linear equations in integers, applied to $a$ and $n$ (with $n \neq 0$), integer solutions exist exactly when $d \mid b$. Now let $[x_0]$ be a solution, and choose $y_0$ with $ax_0 + ny_0 = b$. By the same theorem, the values of $x$ in all integer solutions are exactly $x_0 + \frac{n}{d} k$ for $k \in \mathbb{Z}$.
Counting the classes. Two of these values, for $k$ and $k'$, are congruent modulo $n$ exactly when $n \mid \frac{n}{d}(k - k')$, that is, when $d \mid (k - k')$. So the values for $k = 0, 1, \ldots, d - 1$ lie in $d$ different classes. Every other $k$ is congruent modulo $d$ to one of these, so it gives one of the same classes. Hence there are exactly $d$ solutions in $\mathbb{Z}_n$, and they are the ones listed. $\blacksquare$
Example. Solve $12x = 30$ in $\mathbb{Z}_{42}$. Here $d = \gcd(12, 42) = 6$, which divides 30, so there are six solutions, spaced $42/6 = 7$ apart. To find one, divide the congruence $12x \equiv 30 \pmod{42}$ through by 6 to get $2x \equiv 5 \pmod 7$. The inverse of 2 in $\mathbb{Z}_7$ is 4, so $x \equiv 20 \equiv 6 \pmod 7$. The solutions in $\mathbb{Z}_{42}$ are
$$6, \; 13, \; 20, \; 27, \; 34, \; 41.$$
By contrast $12x = 20$ has no solutions in $\mathbb{Z}_{42}$, since 6 does not divide 20: every multiple of 12 in $\mathbb{Z}_{42}$ is one of $0, 6, 12, \ldots, 36$.
The same theorem solves a congruence from the previous unit. The Diophantine equation $1729x + 1001y = 455$ was solved there, with $y = 35 - 19k$. Reading it modulo 1729 gives the equation $1001y = 455$ in $\mathbb{Z}_{1729}$, with $d = 91$, which divides $455 = 5 \cdot 91$. So there are 91 solutions, spaced $1729/91 = 19$ apart. The script confirms that they are exactly the classes of $y \equiv 16 \pmod{19}$, which is $35 - 19$: the two descriptions agree.
Check your understanding. For an odd modulus $n$, can an equation $ax = b$ in $\mathbb{Z}_n$ have exactly two solutions?
It cannot. The number of solutions is 0 or $d = \gcd(a, n)$, and $d$ divides $n$. A divisor of an odd number is odd, so $d$ is never 2. The script confirms it for every odd $n$ below 100.
The theorem is the modular form of the result on linear equations in integers, and the Chinese remainder theorem extends it to several congruences with different moduli.
The group of units
Do the units form a number system of their own under multiplication?
Proposition. Let $n \ge 2$. The product of two units of $\mathbb{Z}_n$ is a unit, the inverse of a unit is a unit, and $(ab)^{-1} = a^{-1}b^{-1}$.
Proof. If $a$ and $b$ are units, then $(ab)(a^{-1}b^{-1}) = (aa^{-1})(bb^{-1}) = 1 \cdot 1 = 1$, using commutativity and associativity. So $ab$ is a unit with inverse $a^{-1}b^{-1}$. The inverse $a^{-1}$ is a unit because $a^{-1}a = 1$. $\blacksquare$
So the units of $\mathbb{Z}_n$ are closed under multiplication and inverses, and they contain 1. The set of units with this multiplication is called the group of units of $\mathbb{Z}_n$, written $U(n)$ by Judson (2026, §3.2) and often $\mathbb{Z}_n^\times$. It is one of the first examples of a group. In $U(21)$, for instance, $4 \cdot 5 = 20$, and the inverse of 20 is $5^{-1} \cdot 4^{-1} = 17 \cdot 16 = 272 = 20$, consistent with $20 = -1$ being its own inverse.
The number of units of $\mathbb{Z}_n$ is the number of integers from 1 to $n$ that are relatively prime to $n$. It is Euler's phi function $\varphi(n)$. For $n = 1, \ldots, 12$ its values are
$$1, 1, 2, 2, 4, 2, 6, 4, 6, 4, 10, 4,$$
and $\varphi(p) = p - 1$ for a prime $p$, as the theorem on prime moduli says. For the running examples, $\varphi(13) = 12$, $\varphi(21) = 12$ and $\varphi(1729) = 1296 = 6 \cdot 12 \cdot 18$. Here $6$, $12$ and $18$ are $\varphi$ of the prime factors 7, 13 and 19. That $\varphi$ multiplies over relatively prime factors is a consequence of the Chinese remainder theorem.
The observation that ended the section on zero divisors, that multiplying by a fixed unit rearranges the elements of $\mathbb{Z}_n$, applies to the units themselves. Multiplying each element of $U(n)$ by a fixed unit $a$ gives the same $\varphi(n)$ units in a new order. Comparing the products of the two lists gives Euler's theorem, $a^{\varphi(n)} = 1$ for every unit $a$; for example $5^{12} = 1$ in $\mathbb{Z}_{21}$. With $n$ prime this is Fermat's little theorem, and both are proved in the unit on public-key cryptography.
Wilson's theorem
The pairing of units with their inverses gives a classical result about factorials. In $\mathbb{Z}_{13}$ the nonzero elements pair off as
$$2 \cdot 7 = 1, \quad 3 \cdot 9 = 1, \quad 4 \cdot 10 = 1, \quad 5 \cdot 8 = 1, \quad 6 \cdot 11 = 1,$$
leaving 1 and 12 as their own inverses. Multiplying all twelve nonzero elements together, the five pairs contribute 1 each, so
$$12! = 1 \cdot 12 \cdot 1^5 = 12 = -1 \quad \text{in } \mathbb{Z}_{13}.$$
Indeed $12! = 479{,}001{,}600 = 13 \cdot 36{,}846{,}276 + 12$.
Theorem (Wilson). If $p$ is prime, then $(p - 1)! \equiv -1 \pmod p$.
The idea is the one just seen for 13: the factors of $(p - 1)!$ cancel in inverse pairs, and only 1 and $-1$ are left over.
Proof. For $p = 2$, $1! = 1 \equiv -1 \pmod 2$. Let $p$ be an odd prime. Every nonzero element of $\mathbb{Z}_p$ is a unit, and its inverse is unique. So the nonzero elements fall into pairs $\{a, a^{-1}\}$ with $a \neq a^{-1}$, together with the elements that are their own inverses. An element with $a = a^{-1}$ satisfies $a^2 = 1$, that is, $(a - 1)(a + 1) = 0$. Since $\mathbb{Z}_p$ has no zero divisors, $a - 1 = 0$ or $a + 1 = 0$, so $a = 1$ or $a = -1$, and these are different because $p > 2$. The product of all the nonzero elements is therefore $1 \cdot (-1)$ times a product of pairs each equal to 1, which is $-1$. That product is the class of $(p - 1)!$. $\blacksquare$
The proof used the absence of zero divisors exactly where the integers modulo 24 failed, in concluding from $(a - 1)(a + 1) = 0$ that one factor is zero. For composite moduli the theorem fails badly: the script finds $20! \equiv 0 \pmod{21}$, since 3 and 7 both appear among the factors.
Check your understanding. Is $(n - 1)! \equiv 0 \pmod n$ for every composite $n$? Try $n = 9$ and $n = 4$.
Not for every one. For $n = 9$, the factors of $8!$ include 3 and 6, whose product 18 is a multiple of 9, so $8! \equiv 0 \pmod 9$. For $n = 4$, $3! = 6 \equiv 2 \pmod 4$: the only way to write 4 as a product of two factors larger than 1 is $2 \cdot 2$, and $3!$ contains the factor 2 only once. For the running modulus the answer is 0 again: 7, 13 and 19 all appear among the factors of $1728!$, so their product 1729 divides it. The script confirms all three. Far from $-1$, the product of the nonzero classes of $\mathbb{Z}_{1729}$ is 0.
Where it leads
- The ring axioms abstract the arithmetic of $\mathbb{Z}$ and $\mathbb{Z}_n$, and the distinction drawn here becomes the distinction between integral domains, fields, and rings with zero divisors.
- Inverses modulo $n$, computed with the extended Euclidean algorithm, produce the decryption key in the RSA cryptosystem, and Euler's theorem shows that decryption works.
- Inverses modulo a polynomial, computed the same way, are how division is done in the finite fields built from irreducible polynomials.
- $U(n)$ is a group, and Lagrange's theorem on the sizes of subgroups (Cosets and Lagrange's Theorem) gives a second proof of Euler's theorem.
What we have learned
A class $[a]$ in $\mathbb{Z}_n$ can be inverted exactly when $\gcd(a, n) = 1$, and the extended Euclidean algorithm finds the inverse. Every other nonzero class is a zero divisor, so 13 and 21 differ because 13 is prime. A linear equation $ax = b$ has 0 or $\gcd(a, n)$ solutions, and the units form a group whose inverse pairs proved Wilson's theorem.
The integers and $\mathbb{Z}_n$ now share one list of laws while differing in units and zero divisors. What can be proved from the laws alone, for every system that obeys them? That question starts the next unit, Rings, with Rings: Definition and Examples.
References
- Hungerford, T. W. (2014). Abstract Algebra: An Introduction (3rd ed.), §2.3. Brooks/Cole, Cengage Learning. The course text: for $p > 1$, $p$ is prime if and only if every nonzero element of $\mathbb{Z}_p$ has an inverse, if and only if $\mathbb{Z}_p$ has no zero divisors (Theorem 2.8); $[a]x = [1]$ is solvable in $\mathbb{Z}_n$ if and only if $\gcd(a, n) = 1$ (Theorem 2.9), restated for units as Theorem 2.10; the definitions of unit and zero divisor. record · 44 pages
- Judson, T. W. (2026). Abstract Algebra: Theory and Applications (annual edition, August 2026). Free online at judsonbooks.org. Proposition 3.1.4(6) (inverses modulo $n$ exist exactly for $a$ relatively prime to $n$); §3.2, the group of units $U(n)$; §6.3, Euler's phi function, $\lvert U(n) \rvert = \varphi(n)$ (Theorem 6.3.1) and Euler's theorem (Theorem 6.3.2); §16.2, units, zero divisors and fields in a general ring. record · 44 pages
- Python Software Foundation. The Python Standard Library, Built-in Functions,
pow. docs.python.org/3/library/functions.html. The three-argument form with a negative exponent returns a modular inverse (since Python 3.8). record · 2 pages