# Lecture 7: Modular Algorithms

This lecture introduces an algorithmic concept, called modular algorithms, that are commonly used in computer algebra systems such as Maple. A modular algorithm performs a computation over a domain, such as the integers or integral polynomials, by computing the result in a set of homomorphic images, e.g. modulo a set of primes, and uses the results in the "modular" domains to construct the result for the original problem using the using the Chinese Remainder algorithm, interpolation, or a similar construction.

### Background Material

Also review Maple's chrem and interpolation (interp and the newer PolynomialInterpolation) functions.

### Topics

• Chinese Remainder Theorem (CRT)
1. Existence proof
2. Constructive proof using the Extended Euclidean algorithm
• Modular algorithm for integer multiplication
1. Reduce inputs mod sufficiently many primes (wordsize)
2. Multiply mod the primes
3. Recover integer product using the CRT

### Maple worksheets and programs and other resources

• mod.mws - Maple worksheet on modular arithmetic, fast powering, the CRT, and modular algorithms
• mod.ppt (mod.pdf) - slides on modular arithmetic

### Assignments

Created: Oct. 20, 2005 by jjohnson@cs.drexel.edu