Section 8.1 The Integers Modulo
Subsection 8.1.1 Definition
It is time for us to finally define what we have been working with for quite a while now.
Definition 8.1.1. Integers Modulo .
For a positive integer
In the case where
xxxxxxxxxx
def addition_table_(n=(11,[2..50])):
P=[[mod(a,n)+mod(b,n) for a in [0..n-1]] for b in [0..n-1]]
pretty_print(html("The addition table for modulus $%s$"%(n,)))
pretty_print(html(table(P, header_row = True, frame = True)))
xxxxxxxxxx
def _(n=(11,[2..50])):
P=[[mod(a,n)*mod(b,n) for a in [0..n-1]] for b in [0..n-1]]
pretty_print(html("The multiplication table for modulus $%s$"%(n,)))
pretty_print(html(table(P, frame=True)))
Subsection 8.1.2 Visualization
What's even better is to see this visually! I still can't get over how easy it is for me to do this in Sage (and other math programs), such as in the following graphic and interact. It is so cool that my (non-mathematician) wife says, βWhat's that β it's neat!β I wish more people could experience this joy of beauty in math.
xxxxxxxxxx
def multiplication_table_plot(n=(7,[2..50])):
P=matrix_plot(matrix(n,[mod(a,n)*mod(b,n) for a in srange(n) for b in srange(n)]),cmap='jet')
show(P,figsize=7)
Subsection 8.1.3 Inverses
Let's focus on the tables/graphs for whenFact 8.1.5.
When
Proof.
If \(\gcd(a,n)=1\text{,}\) then \(ax\equiv b\) (mod \(n\)) has a unique solution in \(\mathbb{Z}_n\text{.}\) So if \(n=p\) is prime, then \(\gcd(a,p)=1\) always, except for \(a\equiv 0\text{.}\)
Now we let \(b=1\text{,}\) and finding \(x\) becomes the same as finding the inverse number of \(a\) (recall Definition 5.3.4). So for prime moduli, every non-zero element has a unique inverse in \(\mathbb{Z}_p\text{.}\)
xxxxxxxxxx
inverse_mod(26,31)
xxxxxxxxxx
c = mod(26,31)
c^-1
xxxxxxxxxx
c = mod(26,31)
c*c^-1