I am working on a problem I am pretty close to solving but I can't figure out the last part. I used some algebraic manipluation to break the problem down. The problem is:
Show that the following congruence is true
a^b = ((a mod n)^b) (mod n)
for any positive integers a, b, and n.
Hint: Number a can be written as a = q*n + r, where q = floor brackets a/n, and r = a mod n.
My attempt it:
(q*n +r)^b = ((a mod n)^b) * (mod n)
(q*n)^b + (a mod n)^b = ((a mod n) ^b) * (mod n)
(a)^b -(r)^b = ((a mod n) ^b) * (mod n)
(a)^b = modn ----> divided by ((a mod n)^b)
Am I doing this correctly and if so how can I prove this is true? Is there a trick I am missing? I think that by simplifying it further I would just keep going in a loop.
Thanks!
Hint: Let $a^b = (qn+r)^b$. Expand the right-hand side using the binomial theorem and see what you can discard as being $\equiv 0 \bmod n$.