Show that $$a^2 \mathrm{\ mod \ } b = (a \mathrm{\ mod \ } b)^2 \mathrm{\ mod\ } b$$ for $ a, b \in \mathbb{Z}^+ $.
this was derived from an Informatics olympiad question.
Show that $$a^2 \mathrm{\ mod \ } b = (a \mathrm{\ mod \ } b)^2 \mathrm{\ mod\ } b$$ for $ a, b \in \mathbb{Z}^+ $.
this was derived from an Informatics olympiad question.
$$a=kb+n\\a^2=k^2b^2+2kbn+n^2\\a^2=n^2\mod{b}$$ Now since $a=n \mod{b}$ this is the proof
Hint $ $ let $\ \bar a := a\ {\rm mod}\ b.\ $ Then $\ {\rm mod}\ b\!:\ a\equiv \bar a\,\overset{\rm\color{#c00}{CPR}}\Rightarrow\, a^2\equiv {\bar a}^2\,$ thus $\, a^2\,{\rm mod}\ b = {\bar a}^2\,{\rm mod}\ b$
Above we employed $\rm\color{#c00}{CPR} =$ Congruence Product Rule. You will need to justify the congruence after "Then" and the equality after "thus" - both of which are straightforward.
Remark $ $ Generally, as above, to prove an identity about mod as an operator it is usually easiest to first convert it into the more flexible congruence form, using $\color{#c00}\Longleftarrow$ in the equivalence, then prove it using congruences, then at the end, convert it back to operator form, using $\color{#c00}\Longrightarrow$ in the equivalence.
For a similar example consider equivalence of fractions, $\,\frac{a}b \equiv \frac{c}d\iff ad = bc.\,$ It would be quite cumbersome to do fraction arithmetic if we required that all fractions always be in normal (reduced) form, i.e. in least terms. Instead, it proves more convenient to have the flexibility to work with arbitrary equivalent fractions. For example, this allows us to state the fraction addition rule in very simple form by first choosing convenient reps having a common denominator.
See here for further discussion on $\!\bmod\!$ as a binary operator vs. equivalence relation.