TITLE: What exactly is $\mathbb{Z_n}$?
QUESTION [5 upvotes]: My impression has been that $\mathbb{Z_n}$ is the set $\{0,1,...,n-1\}$ under binary operation addition modulo $n$. However I'm also coming across this notion that $\mathbb{Z_n}$ is actually a set of equivalence classes of equivalence relation $x\sim y \iff x \equiv y$ mod $n$ and the addition here is actually addition of equivalence classes rather than simply addition of integers modulo $n$. Is this correct? So would it be correct to say $\mathbb{Z_n} = \{n,n+1,...,2n-1\}$? if we are considering these elements as being equivalence classes?

REPLY [2 votes]: Below I explain the general idea, which works not only for rings but also for any algebraic structure definable by $\rm\color{#c00}{universal}$ equational axioms ("identities") such as $\,\color{#c00}{\forall x,y,z\!:}\,x(y+z) = xy+xz\,$.
$a\equiv b\pmod{\! n}\iff n\mid a-b\,$ is a congruence relation (on a ring) i.e. it is  an equivalence relation that is furthermore compatible with all of the ring operations addition and multiplication, i.e. congruence satisfies the following Congruence Sum & Product Rules
$$\begin{align} a_1\equiv b_1\\ a_2\equiv b_2\end{align}\ \Rightarrow\ \begin{array}{}a_1 + a_2\equiv b_1+b_2\\ a_1 \times a_2\equiv b_1 \times b_2 \end{array}\qquad$$
This implies that the ring operations descend to well-defined operations on the equivalence classes $\,[a] = a+n\Bbb Z\,$ via $\,[a]+[b] := [a+b],\ [a]\times [b] := [a\times b],\,$ and the map $\, a\mapsto [a]\,$ is a surjective ring hom, which immediately implies that all the ring laws persist in the image $\,\Bbb Z_n,\,$ so $\,\Bbb Z_n\,$ has associative and commutative addition and multiplication, connected via the distributive law, so arithmetic in $\,\Bbb Z_n\,$ is essentially the same as in $\,\Bbb Z,\,$ except that some elements are forced equal.
For computational purposes it is often convenient to map the classes to normal (canonical) representatives $\,h\,:\, [a]\mapsto \bar a.\,$ The most common choice is its least nonnegative element $\,\bar a := a\bmod n\,$ (remainder reps), but also convenient are least magnitude reps, e.g. $\,0,\pm1,\pm2\pmod{\!5}.\,$ Generally we can use any complete system of residues, i.e. any $\,n\,$ integers such that every integer is congruent to exactly one in our set of complete residue reps.
Then we can transport the ring structure to our normal forms by pulling (back) the ring operations along $h$ to obtain the induced ring operations on the normal forms as follows:
$$\color{#c00}{\bar a} + \bar b = h([a])+h([b]) = h([a]+[b]) = h([a+b]) = \color{#0a0}{\overline{a+b}}$$
e.g. this becomes   $\ \color{#c00}{a\bmod n} + b\bmod n\, = \, \color{#0a0}{(a+b)\bmod n}\ $ using common normal forms.
Said equivalently, to perform an operation on normal forms $\,\bar a,\,\bar b,\,$ we apply $h^{-1}$ to map them to their associated classes $\,[a],[b],\,$ then we perform the operation on the classes yielding $\,[a+b],\,$ then finally we apply $h$ to map that result to its normal form $\,\overline{a+b}.\,$  So the normal forms are essentially canonical  "labels" or "names" for their congruence classes. We could instead use any set of $\,n\,$ elements as labels, but using elements from the original ring $\,\Bbb Z\,$ makes it more intuitive how the normal rep corresponds to the class.
As above, in Euclidean domains like $\,\Bbb Z\,$ and $\,F[x]\,$, which enjoy Euclidean division with smaller remainder, it is convenient to use the the remainder ("least Euclidean size") as the normal rep, which is discussed further here, showing how Hamilton's pair representation for complex numbers is just a special case of this, viz. $\Bbb R[x]\bmod x^2\!+\!1\cong \Bbb R[i]\cong \Bbb C$.