Finding an inverse using the square and multiply algorithm

453 Views Asked by At

Given $7^{45}\equiv32 \bmod 101$, find $32^{-1}$ using square and multiply.

What I did was since $(7^{45})^{-1}$ is equal to $(32)^{-1}$, and $-45\bmod 101 = 56$ then $32^{-1} = 7^{56}$. I then used square and multiply but I get $16$ for $7^{56}$ but I know that the inverse of $32$ modulo $101$ is $60$.

Am I missing a property of square and multiply or of modular arithmetic for this not to work?

1

There are 1 best solutions below

0
On

People have pointed you to the right direction. I'll just do it here for my own sake. Everything below is $\pmod{101}$.

$$ 32^{-1}\equiv 7^{55}\equiv 108^{55}\equiv (2^2 \cdot 3^3)^{55}\equiv 2^{110} \cdot 3^{165} \equiv 2^{10} \cdot 3^{65} \equiv 2^{10} \cdot 3 \cdot (81)^{16} \\ \equiv 2^{10} \cdot 3 \cdot (-20)^{16} \equiv 2^{10} \cdot 3 \cdot 2^{16} \cdot 10^{16} \equiv 2^{26} \cdot 3 \cdot 100^8 \equiv \frac{(2^9)^3 \cdot 3}{2}\\ \equiv \frac{512^3}{2}\cdot 3 \equiv \frac{7^3}{2} \cdot 3 \equiv \frac{343}{2}3 \equiv \frac{40}{2}\cdot 3 \equiv 60. $$