Property of modulo division

189 Views Asked by At

I wanted to check if it is true, that $$a^{3b} \pmod n = (a^{b} \pmod n)^{3}\ ?$$

For example when $a = 2, b = 4, n = 5$ I have that $2^{12} \mod 5 = 1$ and $(2^4 \mod 5)^3 = 1$ Is that always true, or maybe the left side should be equal to something different?

2

There are 2 best solutions below

0
On

True, modulo division is if you are working in the ring $\mathbb{Z}/n\mathbb{Z}$, where $(\bar{a}^b)^3 \equiv \bar{a}^{3b}$ for any $\bar{a} \in \mathbb{Z}/n\mathbb{Z}$ (here the overbar means moduo $n$).

3
On

Obviously, you should take $a^{3b} \mod n = (a^{b} \mod n)^{3} \mod n$

Otherwise, say, if your $(a^{b} \mod n)$ is not $1$ but, say, $4$, you'll get $a^{3b} \mod 5 = 64 $ which is technically incorrect (however, still understandable by a human).