Congruence of Powers

Theorem
Let $$a, b \in \Z$$ and $$m \in \N$$.

Let $$a$$ be congruent to $b$ modulo $m$, i.e. $$a \equiv b \left({\bmod\, m}\right)$$.

Then $$\forall n \in \Z_+: a^n \equiv b^n \left({\bmod\, m}\right)$$.

Proof
Proof by induction:

For all $$n \in \Z_+$$, let $$P \left({n}\right)$$ be the proposition $$a \equiv b \left({\bmod\, m}\right) \implies a^k \equiv b^k \left({\bmod\, m}\right)$$.


 * $$P(0)$$ is trivially true, as $$a^0 = b^0 = 1$$.


 * $$P(1)$$ is true, as this just says $$a \equiv b \left({\bmod\, m}\right)$$.

Basis for the Induction

 * $$P(2)$$ is the case $$a^2 \equiv b^2 \left({\bmod\, m}\right)$$, which follows directly from the fact that multiplication modulo $m$ is well-defined.

This is our basis for the induction.

Induction Hypothesis

 * Now we need to show that, if $$P \left({k}\right)$$ is true, where $$k \ge 2$$, then it logically follows that $$P \left({k+1}\right)$$ is true.

So this is our induction hypothesis:


 * $$a \equiv b \left({\bmod\, m}\right) \implies a^k \equiv b^k \left({\bmod\, m}\right)$$.

Then we need to show:


 * $$a \equiv b \left({\bmod\, m}\right) \implies a^{k+1} \equiv b^{k+1} \left({\bmod\, m}\right)$$.

Induction Step
This is our induction step:

Suppose $$a^k \equiv b^k \left({\bmod\, m}\right)$$.

Then $$a^k a \equiv b^k b \left({\bmod\, m}\right)$$ by definition of multiplication modulo $m$.

Thus $$a^{k+1} \equiv b^{k+1} \left({\bmod\, m}\right)$$.

So $$P \left({k}\right) \implies P \left({k+1}\right)$$ and the result follows by the Principle of Mathematical Induction.

Therefore $$\forall n \in \Z_+: a \equiv b \left({\bmod\, m}\right) \implies a^k \equiv b^k \left({\bmod\, m}\right)$$.