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?