3

Why is it true that $x^{ab}\mod{n}=(x^a\mod{n})^b\mod{n}$?

I understand that if I substitute $z$ for $x^a$, I get:

$z^b\mod{n}=(z\mod{n})^b\mod{n}$

$=(z\mod{n})_1*(z\mod{n})_2*...*(z\mod{n})_b\mod{n}$

On Wikipedia, I see that one of the distributive equivalencies for modulo operations is:

$ab\mod{n}=(a\mod{n})(b\mod{n})\mod{n}$

Does this apply to my problem?

1 Answers1

3

Your intuition was right: since a power is nothing but an iterated product, this is indeed a consequence of the more general: $$ (a\bmod n)(b\bmod n) =ab \bmod n $$ by which we mean that the product of any two integers, one of which is congruent to $ a $ and the other to $ b $ modulo $ n$, is congruent to $ ab $ modulo $ n $.

Proof:$$ (a+nk)(b+nl)=ab+n (kb+al+nkl) $$

To get the powers formula, apply this repeatedly, first to $ b=a $, then $b=a^2 $, etc.

Note that this is all just part of saying that the map $\Bbb Z\to \Bbb Z/ n\Bbb Z : a\mapsto a\bmod n $ is a ring homomorphism. It respects products, and therefore it respects powers.