Help me understand 'equivalence classes' and relations I'm reading up on binary relations and I understand them to be a mapping from one set into another.

However I'm having problems understand 'equivalence classes'. My book only gives a pretty dry explanation.

If you could give a good tangible explanation of equivalence relations and equivalence classes, that would be great!
Let $X$ be a finite set and $R \subseteq X^2$ be some binary relation. Then $R$ is very similar to a directed graph that has elements of $X$ as vertices, or in other words, $R$ can be drawn as dots and arrows. The following example depicts a graph and corresponding relation.
$$
\begin{array}{ccc}
1 &amp;\to&amp; \stackrel{\curvearrowright} 2 \\
\downarrow &amp; &amp; \updownarrow\\
3 &amp; \gets &amp; 4
\end{array}
$$
$$
\{(1,2),(1,3),(2,2),(2,4),(4,2),(4,3)\}
$$

Now, to talk about equivalence classes we need an equivalence relation. How an appropriate graph looks like?


It has to be reflexive, that is, each vertex $v$ has to have a loop $\stackrel{\curvearrowleft}v$ like $2$ in the previous example.
It has to be symmetric, i.e. each edge of the graph has to be bidirectional, like $\{2,4\}$ in the above diagram. If all the edges are bidirectional, then such graph is called undirected.
It has to be transitive. This means that the graphs includes all the possible "shortcuts", i.e. if you can get from vertex $u$ to $v$, then there is an edge $u \to v$, or in case of undirected graphs $u \leftrightarrow v$.


The above conditions together imply that if some two vertices are connected, then they belong to a clique (a graph that has all the possible edges, modulo loops), that is, each connected component forms a clique. These cliques are precisely the equivalence classes. In the following diagram we have two: $\{1,2,3,4\}$ and $\{5,6,7\}$ (loops omitted for clarity).

$$
\begin{array}{ccc}
1 &amp;\leftrightarrow &amp; 2 &amp;  &amp; 5 &amp; \leftrightarrow &amp; 6\\
\updownarrow &amp; \swarrow\hspace{-10pt}\nearrow\hspace{-10pt}\nwarrow\hspace{-10pt}\searrow &amp; \updownarrow &amp; &amp;\updownarrow &amp; \swarrow\hspace{-10pt}\nearrow\\
3 &amp; \leftrightarrow &amp; 4 &amp; &amp; 7
\end{array}
$$

Observe, that if we would add edge $4 \to 5$ then symmetry would require also $5  \to 4$ and then transitivity would add all the other edges. The two clusters would merge into a single equivalence class, i.e. the graph would become the $K_7$ clique.

This intuition also holds for infinite sets, but it's hard to draw infinite graphs. 

I hope this helps $\ddot\smile$
Binary relations and equivalence classes are two basic notions that we all learn at the very beginning of school. By this I am saying that you actually very well know what they are and how they work. 

It is only due to the bad influence of Bourbaki, the formalism that was important to address some problem in logic (like consistency) that those dry expositions have permeated areas of mathematics in which they are absolutely not needed, and even become detrimental.

I will use pictures to explain what are these two notions. I will use pictures because it is with pictures we (I) learned (in the first year we entered school in our life) what this concepts are.

Binary relation

In kindergarten they used to gives us pictures of a row of bees and a row of flower pots. 
We were supposed to draw arrows indicating what flowers each bee likes. There were different requirements about the preferences depending on the exercise and the skill the teacher wanted to teach. But a totally freely chosen set of arrows going from the bees to the flowers is what a relation is. 

If we require, for example, that a bee has only one favorite flower then we get a a relation that is what we call a function from bees to flowers. 

If we add to this the requirement, for example, that each flower should have no more than one bee that likes it, they we get a relation that is what we call an injective function from the bees to the flowers. 

And so on. 

Equivalence class

We had this other type of exercise in kindergarten. We were given a figure with many objects: flowers, tools, people, ...

We were given a feature, and we were supposed to enclose in blobs figures that had that feature in common. 

For example, we could be told to group figures by color, or by use, or by kingdom, etc.

Something like this. 



This breaking into classes is what an equivalence relation is.