Extended Euclid’s algorithm
The extended Euclid’s algorithm can be used to find a pair
Modular multiplicative inverse
To calculate the inverse of
- Create an equation in the form of
.𝑛 = 𝑎 ( 𝑞 ) + 𝑟 - Create a new equation where
and𝑎 → 𝑛 𝑟 → 𝑎 - Continue until
𝑟 = 1 - Convert each equation to the form
𝑟 = 𝑛 + 𝑎 ( − 𝑞 ) - Starting from the equation where
, substitute your values slowly working upwards𝑟 = 1 - In the final steps, any
s disappear and𝑛 .− 𝑥 → 𝑛 − 𝑥