Modular Exponentiation definition
Modular exponentiation computes the remainder of an integer power with respect to a positive modulus.
Modular Exponentiation in a picture
How it works
Reduce the base first and reduce after each multiplication. To handle large nonnegative exponents, repeatedly square to obtain powers with exponents 1, 2, 4, and so on. Multiply the powers corresponding to the binary expansion of the desired exponent.
Worked examples
Find 3² mod 5.
9 leaves remainder 4.
Find 3⁴ mod 5.
Square the remainder 4. Then 16 mod 5 = 1.
Find 3⁵ mod 5.
Multiply the previous remainder 1 by 3 to get 3.
Common mistake
You can reduce the base and intermediate products modulo m. The exponent cannot generally be reduced modulo m.
Quick check
What speeds up large exponents?
Show answer
Repeated squaring.
What is 9⁰ mod 7?
Show answer
1.
Sources
Flashcard
Modular Exponentiation
Reveal the definition
Modular exponentiation computes the remainder of an integer power with respect to a positive modulus.
Effortless Math. “Modular Exponentiation.” Math Dictionary.



