Lecture 7: Modular Arithmetic and Fast Powering
This lecture introces the concept of modular arithmetic and presents a fast
algorithm to compute the power of a number modulo another number. Constructive
algorithms, based on the extended Euclidean algorithm, to compute modular
inverses and solve the Chinese Remainder problem is presented. Finally,
a modular algorithm for integer multiplication is discussed.
- Equivalence relations.
- Division with quotient and remainder.
- Euclidean algorithm (and extended version)
Also study Maple's Power, mod, mods, numtheory[phi] and chrem functions.
- Lecture 2 notes on the Euclidean algorithm.
- Chapters 3 and 4 of the text.
- Simple substitution cyphers (see practice assignment)
- Determining that a number is prime without factoring it (Fermat's theorem)
- Equivalence relations
- Equivalence modulo n
- Equivalence classes modulo n
- Modular arithmetic (Z_n)
- definition of + and *
- proof that it is well defined
- modular inverses
- Condition for inverses to exist
- Computing with the extended Euclidean algorithm
- Computing with Fermat's theorem
- The finite field Z_p
- Fermat's theorem and Euler's identity
- Fast algorithm for powering
- repeated multiplication
- binary powering
- Analysis of binary powering
- Chinese Remainder Theorem (CRT)
- Existence proof
- Constructive proof using the Extended Euclidean algorithm
Maple worksheets and programs and other resources
- mod.mw - Maple worksheet on modular arithmetic,
fast powering, the CRT, and modular algorithms
- mod.ppt (mod.pdf)- slides on modular arithmetic
affine.mw - Maple worksheet (practice problems) on
modular arithmetic and Ceasar and Affine cyphers.
Created: April 21, 2008 by jjohnson AT cs DOT drexel DOT edu