Why is the associative property valid for modular arithmetic? 
The associative property is defined in the picture above. The screenshot is from Discrete Math and its Applications 8th edition, by Kenneth Rosen. Also, we have this definition for modular multiplication and addition. 

Both of these images are on page 257 of the textbook.
My question is why is the associativity property valid? Every other property listed is very intuitive, but I don't know how I'd go about proving the associative property. 
 A: Hint:
The author proves

The $\mathbf{mod} \, m$ function has the property that 
$\tag 1 [a \, \mathbf{mod} \, m] \, \mathbf{mod} \, m = a \, \mathbf{mod} \, m$
so, using corollary 2, this is also true,
$\tag 2 (a + b)\, \mathbf{mod} \, m = [a + b \, \mathbf{mod} \, m] \, \mathbf{mod} \, m$

Since there is an accepted completed answer, "here is how it is done strictly":
$\quad (a +_m b)+_m c =[(a +_m b) + c] \, \mathbf{mod} \, m = \big[(a + b) \, \mathbf{mod} \, m + c\big] \, \mathbf{mod} \, m =$
$\quad \quad  \big[(a + b) + c\big] \, \mathbf{mod} \, m =  \big[a + (b+c)\big] \, \mathbf{mod} \, m = \big[a + (b+c) \, \mathbf{mod} \, m \big] \, \mathbf{mod} \, m = $
$\quad \quad \big[a + (b+_mc)\big] \, \mathbf{mod} \, m = a +_m (b+_m c)$
A: The key is to show that $$a+_m(b+_mc)=[a+(b+c)]\mbox{ mod $m$}$$ (and similarly for $(a+_mb)+_mc$). Using the definition of modular arithmetic you've quoted this goes through the fact that $$a+(b+_mc)\equiv a+(b+c)\quad\mbox{ mod $m$}.$$ This is a little cringe-inducing since it mixes integers and integers-mod-$m$; this is in keeping with the definition you've written, but doesn't make sense if we define $\mathbb{Z}_m$ via equivalence classes instead (this is the standard approach, which is more complicated at the outset but ultimately much nicer), and then a slightly different reasoning is needed.
Note that this is all a bit slippery until we've shown that "$+_m$" is in fact well-defined - if you haven't yet, you should do that first.

At that point, associativity of $+_m$ follows immediately from associativity for $+$: we have $$a+(b+c)=(a+b)+c\implies [a+(b+c)]\mbox{ mod $m$}=[(a+b)+c]\mbox{ mod $m$}.$$ This is just a slightly messy example of the more general fact that $$x=y\implies x\mbox{ mod $m$}=y\mbox{ mod $m$},$$ that is, that "mod" is well-defined.
A: Ring $\rm\color{#c00}{identities}$ (e.g. associative, commutative, distributive laws) that are true in $\,\Bbb Z\,$ are preserved in $\,\Bbb Z_m = \Bbb Z\bmod m\,$ simply because the map $\,h\,:\, a\mapsto a_m\,$ is a surjective (onto) ring hom, i.e. $\,h(a+b) = h(a)+_mh(b),\ $ $h(a\times b) = h(a)\times_m h(b),\, $ so an image of a ring identity (law) in the quotient ring has the same form, i.e. it is preserved, e.g. for associativity of addition we have
$$\begin{align}   (a+b)\ \ \ +\ \ \ c\ \ \  &=\ \ \  a\ \ \ \, +\, \ \ \ (b+c)\ \ \ {\rm in}\,\ \Bbb Z\\[.3em]
\Rightarrow\ \ \ \ \ \ \ \ \ \ \ \ \ \,  h(a+b)+_m h(c) &= h(a)+_m h(b+c)\ \ \ {\rm in}\,\ \Bbb Z_m\\[.3em]
\Rightarrow\ \ (h(a)+_m h(b))+_m h(c) &= h(a)+_m (h(b)+_m h(c))\\[.3em]
{\rm i.e.}  \ \ \ \ \ \ \ \ \,(\bar a\ +_m\ \bar b)\ \ +_m\,\ \ \bar c\ \ &=\ \ \ \ \bar a\,\ +_m\ \ \ (\bar b\ +_m\ \bar c)
\end{align}\qquad\quad$$
Being surjective (onto), for any  $\,\bar a,\bar b,\bar c\in \Bbb Z_m\,$ there  are $\,a,b,c\in\Bbb Z\,$ that map to them, so the final equality above is true for all elements in $\Bbb Z_m,$ i.e. addition is associative in $\Bbb Z_m$ since it's associative in $\Bbb Z.\,$ Similarly, associativity of  multiplication, and other (universal) ring laws are inherited, e.g. the commutative and distributive laws.
Generally this shows that algebraic structures axiomatizable by equational identities (varieties) are closed under homomorphic images, i.e. all identities persist to be true in moduluar images. Varieties are also clearly closed under subalgebras and products. Conversely Birkhoff showed (HSP Theorem) that a class of algebraic structure enjoying these three closure properties can be defined using only equational identities as axioms. For example, fields are not closed under product so they have no such axioms, e.g. we need to use an axiom like $\forall x\neq 0\,\exists y\!:\ xy = 1\,$ which is not an $\rm\color{#c00}{identity}$, i.e. not of form $\,\color{#c00}{\forall x,y}\!:\  f(x,y) = g(x,y)\,$ where $\,f,g\,$ are "polynomials" (i.e. compositions of operations of the algebra, here $+,*,0,1$ for rings).
