Number Theory / Modular arithmetic
Modular Arithmetic
Arithmetic on a clock: congruences, inverses and fast exponentiation.
Contents 3 sections
By the end you can
- Work with congruences modulo
- Find modular inverses when they exist
- Compute large powers by repeated squaring
Helps to know: GCD and the Euclidean Algorithm
§1Congruence
Congruences can be added, subtracted and multiplied like equations. To find the last digit of , work modulo 10: the powers of 7 end in and then repeat, and is a multiple of , so the answer is .
§2Division and inverses
An inverse of modulo is a number with . It exists exactly when , and the extended Euclidean algorithm computes it.
Example 1Inverse of 3 modulo 11
- Look for .
Check yourself
- Q1
- Q2Does have an inverse modulo ?