In modular arithmetic, why is (x mod n)^y mod n == x^y mod n?

574 Views Asked by At

Why is (x mod n)^y mod n == x^y mod n? It seems to me like there is a property in modular arithmetic that explains why, does anyone have a simple way of explaining it?

1

There are 1 best solutions below

0
On

Let $$g^{k_1}=nq_1+r$$therefore$$(g^{k1}\mod n)^{k2} \mod n=r^{k_2}\mod n$$Furthermore:$$(g^{k_1})^{k_2}\mod n=(nq+r)^{k_2}\mod n=nq_2+r^{k_2}\mod n=r^{k_2}\mod n$$therefore$$(g^{k1}\mod n)^{k2} \mod n=(g^{k_1})^{k_2}\mod n$$