This preview shows pages 1–3. Sign up to view the full content.
CS 2800: Discrete Math
Sept. 26, 2011
Lecture
Lecturer: John Hopcroft
Scribe: June Andrews
Review
See previous lecture notes for the Fundamental Theorem of Arithmetic, Euler’s
φ
function, and Euler’s
Theorem. The cool part of Euler’s Theorem was that we got 2 very useful corollaries from it: Fermat’s Little
Theorem and a test of primality.
And a small note, the exam will only cover today’s lecture and previous lectures.
Module Tricks
We present yet another corollary from Euler’s Theorem (useful theorem!).
Corollary 1.
If
gcd
(
a,n
) = 1
, then
a
x
≡
a
x
mod
φ
(
n
)
mod
n
.
This may seem a bit of a surprise. How did we get the mod
φ
(
n
) in the exponent? Let us remember our
mod tricks and look at the proof.
Proof.
We need two tools to prove the corollary:
1. Euler’s theorem: if
gcd
(
a,n
) = 1, then
a
φ
(
n
)
≡
1 mod
n
2. The module of a product is the product of the modules:
z
1
≡
y
1
mod
n
z
2
≡
y
2
mod
n
⇒
z
1
z
2
≡
y
1
y
2
mod
n.
So if
x
= (
x
mod
φ
(
n
)) +
iφ
(
n
), then
a
x
≡
±
a
x
mod
φ
(
n
)
²±
a
iφ
(
n
)
²
mod
n
≡
±
a
x
mod
φ
(
n
)
mod
n
²±
a
iφ
(
n
)
mod
n
²
mod
n
by product of modules
≡
±
a
x
mod
φ
(
n
)
mod
n
²
(1 mod
n
)
mod
n
by Euler’s Theorem
≡
a
x
mod
φ
(
n
)
mod
n
Done!
Now how does this help us?
Example 2.
Let’s say we wanted to calculate
2
999
mod 21
. It would be nice if we could avoid calculating
2
999
. To use the previous corollary, we need to check
a
= 2
and
n
= 21
are relatively prime,
gcd
(
a,n
) =
gcd
(2
,
21) = 1
. So we can!
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document We now calculate
φ
(21)
. Instead of linearly determining(see deﬁnitions)
φ
(21)
, remember that
21 = 3
*
7
and that
φ
(
pq
) = (
p

1)(
q

1)
. Hence,
φ
(21) = 12
.
Putting it altogether:
2
999
≡
2
999
mod 12
mod 21
≡
2
3
mod 21
≡
8 mod 21
That’s how the corollary helps  it allows us to reduce the exponent dramatically.
Even using that trick, it may not reduce the exponent to a particularly small number. We may be faced
with an irreducible
mod calculation of 2
100
. We still don’t want to have to multiply 2(2(2(2(
...
)))). But
we can reexamine the order with which we multiply, like 2
8
= 2
4
*
2
4
. So if we already had 2
4
, we could
just square it to get 2
8
. In an inductive manner of thought, the same logic can be applied to 2
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 11/11/2011 for the course CS 2800 at Cornell University (Engineering School).
 '07
 SELMAN

Click to edit the document details