Download Elementary Number Theory

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Elementary Number Theory
Franz Luef
Franz Luef
MA1301
Congruences – Modular Arithmetic
Congruence
The notion of congruence allows one to treat remainders in a
systematic manner. For each positive integer greater than 1
there is an arithmetic mod n that mirrors ordinary
arithmetic, but is finite, since it involves only the remainders
0, 1, ..., n − 1 occuring on division by n.
Definition
Integers a and b are said to be congruent mod n, written
a≡b
mod n,
if they leave the same remainder on division by n.
In other words, a ≡ b mod n, if n divides a − b.
Franz Luef
MA1301
Congruences
Definition
The set of remainders {0, 1, ..., n − 1} is called the least
sytem of residues modulo n.
We denote the system of residues modulo n bu Zn .
A set of integers a1 , ..., an form a complete system of
residues modulo n if these are congruent to {0, ..., n − 1}
modulo n.
The integers that leave remainder r on division by n form
what is called the congruence class of a,
{nk + a : k ∈ Z},
denoted by nZ + a. For example, 2Z is {even numbers}
and 2Z + 1 is {ood numbers}. Each congruence class is a
set of equally spaced points along the real line.
Franz Luef
MA1301
Examples
Examples
8 ≡ 3 mod 5, since 8 − 3 = 1 · 5
Complete set of residues modulo 5: {0, 1, 2, 3, 4} but also
{−5, 11, 32, −13, 24}
Fact: A set of n integers a1 , ..., an forms a complete set of
residues modulo n if and only if NO two integers ai and aj
are congruent modulo n, i.e. ai − aj = k · n does not hold
for a k ∈ Z.
One can add and multiply congruences very much like one
can add and multiply integers:Modular Arithmetic.
Franz Luef
MA1301
Modular Arithmetic
Basic Rules
a ≡ a mod n
If a ≡ b mod n, then b ≡ a mod n.
If a ≡ b mod n and b ≡ c mod n, then a ≡ c mod n.
If a ≡ b mod n and c ≡ d mod n, then a + c ≡ b + d
mod n and ac ≡ bd mod n.
If a ≡ b mod n, then ak ≡ b k mod n.
Example
3 ≡ 8 mod 5 and 8 ≡ 23 mod 5 gives 3 ≡ 23 mod 5
3 ≡ 8 mod 5 and 1 ≡ 11 mod 5 gives 4 ≡ 19 mod 5
3 ≡ 8 mod 5 and 1 ≡ 11 mod 5 gives 3 ≡ 88 mod 5
Franz Luef
MA1301
Modular Arithmetic
Division
If a ≡ b mod n and c ≡ d mod n, then
ac ≡ bd mod n.
In particular: If a ≡ b mod n, then ac ≡ bc mod n.
In contrast to the integers, one has to be careful about
cancelling common factors in modular arithmetic!
15 · 2 ≡ 20 · 2 mod 10 BUT 15 6≡ 20 mod 10.
6 ≡ 16 mod 5 is 2 · 3 ≡ 2 · 8 mod 5 is the same as 3 ≡ 8
mod 5.
6 · 4 ≡ 0 mod 12, BUT 6 ≡ 6 mod 12 and 4 ≡ 4
mod 12.
Franz Luef
MA1301
Cancellation of factors in modular arithmetic
Lemma
Suppose a ≡ b mod n. Then a ≡ b mod
n
gcd(c,n) .
Check it in our example: 15 · 2 ≡ 20 · 2 mod 10,
gcd(2, 10) = 2 15 ≡ 20 mod 5.
Corollary
Suppose gcd(d, n) = 1. Then a · c ≡ b · c mod n implies
a ≡ b mod n.
Suppose p is a prime number. If c is not a multiple of p,
then Then a · c ≡ b · c mod p implies a ≡ b mod p.
Moral: Congruences modulo a prime number p behave very
differently from congruences modulo a composite number.
Franz Luef
MA1301
Congruences – Modular Arithmetic
Definition
Integers a and b are said to be congruent mod n, written
a≡b
mod n,
if they leave the same remainder on division by n.
In other words, a ≡ b mod n, if n divides a − b.
Remark
What is −3 ≡ x mod 7?
Answer: x = 4.
General case: −k mod n is n − k ≡ −k mod n
n ≡ 0 mod n is the same as n − k + k ≡ 0 mod n.
Therefore, n − k ≡ −k mod n.
Franz Luef
MA1301
Congruences – Modular Arithmetic
Cancelling Factors in congruences
Suppose ac ≡ bc mod n. Then a ≡ b mod
n
gcd(c,n) .
Special case
Suppose gcd(c, n) = 1. Then a · c ≡ b · c mod n implies
a ≡ b mod n.
Suppose p is a prime number and c is not a multiple of p.
Then a · c ≡ b · c mod p implies a ≡ b mod p.
Franz Luef
MA1301
Linear congruences
Linear congruences
The equation ax ≡ b mod n has a solution if and only if
d = gcd(a, n) divides b.
If d = gcd(a, n) divides b, then it has d mutually incongruent
(d−1)n
solutions modulo n: x0 , x0 + dn , x0 + 2n
, where
d , ..., x0 +
d
x0 is the particular solution determined from the Euclidean
algorithm.
Corollary
Suppose gcd(a, n) = 1. Then ax ≡ b mod n has a unique
solution.
Franz Luef
MA1301
Linear congruences
Solution
Find y ∈ Z such that ay ≡ 1 mod n, i.e. find the
multiplicative inverse of a modulo n.
Use the Euclidean algorithm to find such an y .
Multiply the linear congrunce ax ≡ b mod n with the
multiplicative inverse y .
Then yax ≡ yb mod n, which yields x ≡ yb mod n.
Franz Luef
MA1301
Linear congruences
Example
37x ≡ 15 mod 49.
gcd(37, 49) = 1 implies that the equation has exactly ONE
solution.
Find the multiplicative inverse of 37 modulo 49, i.e.
37y ≡ 1 mod 49.
Euclidean algorithm: 49 = 37 + 12, 37 = 3 · 12 + 1. Thus
1 = 37 − 3.12 = 37 − 3(49 − 37) = 4 · 37 − 3 · 49.
4 is the multiplicative inverse of 37 modulo 49.
37x ≡ 15 mod 49, therefore 4 · 37x ≡ 15 mod 49, i.e.
x ≡ 11 mod 49.
Franz Luef
MA1301
Linear congruences
Example
18x ≡ 8 mod 14.
gcd(14, 18) = 2 implies that the equation has TWO
solutions.
2 · 9x ≡ 2 · 4 mod 2 · 7 is equivalent to 9x ≡ 4 mod 7
because gcd(2, 14) = 2.
Find the multiplicative inverse of 9 modulo 7, i.e. 9y ≡ 1
mod 7.
Euclidean algorithm: 9 = 7 + 2, 7 = 3 · 2 + 1. Thus
1 = 4 · 7 − 3 · 9. −3 is the multiplicative inverse of 9
modulo 7, i.e. −3 ≡ 4 mod 7.
9x ≡ 4 mod 7, therefore 4 · 9x ≡ 4 · 4 mod 7, i.e. x0 ≡ 2
mod 49. The second solution:
x1 = x0 + 14/2 = 2 + 7 = 9.
Franz Luef
MA1301
Pascal’s triangle
Franz Luef
MA1301
Pascal’s triangle modulo 2
Pascal’s Triangle mod 2
Franz Luef
MA1301
Binary representation of integers
Motivation
G. W. Leibniz, one of the inventors of calculus and
contempary of Newton, was the first to express integers in
terms of powers of 2.
In 1671 Leibniz invented a machine that could execute all
four arithmetical operations, which later was actually build.
Binary representations are ubiquitious nowadays, because
that’s the way computers operate and all our data are
stored on DVD, flashdrive,...! In other words our digital
world has only two fingers or in Latin: two digits.
We are going to use them in our computations of
congruences!
Franz Luef
MA1301
Binary Representation
Procedure
Instead of powers of 10 we want to write a number in
terms of powers of 2.
The first few powers of 2 are:
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, ...
Let us write 984 = 9 · 102 + 8 · 10 + 4 · 100 in powers of 2:
Find the largest power of 2 that does not exceed 984 (that
is 512 = 29 in this case), and then procede successively
with smaller powers of 2 as follows:
984 = 512 + 472, 472 = 256 + 216, 216 =
128 + 88, 88 = 64 + 24, 24 = 16 + 8.
984 = 29 +28 +27 +26 +0·25 +24 +23 +0·22 +0·21 +0·20
(984)2 = 1111011000
Franz Luef
MA1301
Binary Representation
Summary
A 1 in our binary representation means we are including the
power of 2 and a 0 that we are excluding this power of 2.
Examples
What are the binary expansion of 7, 11, 15, 25 and of
6, 10, 14, 20?
The answers are as follows:
(7)2 = 111, (11)2 = 1011, (15)2 = 1111, (25)2 = 11001
(6)2 = 110, (10)2 = 1010, (14)2 = 1110, (20)2 = 10100.
What is the emerging pattern? odd numbers have a 1 as
last digit and even numbers a 0 in the last digit of their
binary expansions.
Franz Luef
MA1301
Linear congruences and Chinese Remainder
Theorem
Linear congruences
The equation ax ≡ b mod n has a solution if and only if d
divides b, where d is the gcd(a, n).
If d divides b, then it has d mutually incongruent solutions
(d−1)n
modulo n: x0 , x0 + dn , x0 + 2n
.
d , ..., x0 +
d
Corollary
Suppose gcd(a, n) = 1. Then ax ≡ b mod n has a unique
solution.
Idea
The linear congruence is equivalent to the linear Diophantine
equation ax − ny = b.
Franz Luef
MA1301
Linear congruences and Chinese Remainder
Theorem
Idea
By the result about linear Diophantine equations we have that
it is soluble if and only if d|b. Furthermore, the solutions are in
this case: Suppose x0 , y0 are solutions, then any other solution
is of the form x = x0 + dn t and y = y0 + dn t for
t = 0, 1, ..., d − 1.
Example
18x ≡ 8 mod 14
We have to find integers x, y such that 18x − 14y = 8.
gcd(18, 14) = 2
Therefore we can solve 18x − 14y = 2 with particular
solution is x0 = 4 and y0 = 5. Thus 18 · 16 ≡ 8 mod 14
and the other solution is 2 − 14/2 = −5 ≡ 9 mod 14.
Franz Luef
MA1301
Linear congruences and Chinese Remainder
Theorem
Chinese Remainder Theorem
Let n1 and n2 be two integers with gcd(n1 , n2 ) = 1. Suppose
a1 and a2 are integers. Then the simultaneous congruences
x ≡ a1 mod n1 and x ≡ a2 mod n2
has exactly one solution x with 0 ≤ x < n1 n2 .
The proof provides the method to solve these kind of
equations. Therefore, we discuss it in a particular example.
Example
What are the solutions to
x ≡ 8 mod 11 and x ≡ 3 mod 19?
Franz Luef
MA1301
Linear congruences and Chinese Remainder
Theorem
Example
x ≡ 8 mod 11 and x ≡ 3 mod 19
The solution to the first congruence are numbers of the
form x = 11y + 8.
Substitute this into the second congruence: 11y + 8 ≡ 3
mod 19
11y ≡ 14 mod 19. The solution is y1 ≡ 3 mod 19.
Solutions to the original congrunence via
x1 = 11y1 + 8 = 11 · 3 + 8 = 41.
Check our solution: (41 − 8)/11 = 3 and (41 − 3)/19 = 2.
Franz Luef
MA1301