Let $f : X \to Y$ be an arbitrary function and define a relation $R \subseteq X \times X$ by
$R = \{ (x_1, x_2) : f(x_1) = f(x_2) \}$
Show that $R$ is an equivalence relation and describe its equivalence classes.
The provided solution was
For each $y \in Y$, the pre-image of $y$, usually denoted $f^{-1}(y)$, is an equivalence class.
I know that, for an equivalence relation on a set $A$, an equivalence class is defined as
$[a]_R = \{b \in A : (a, b) \in R \}$ for all $a \in A$.
Using the definition of an equivalence class, my impression was that we need to find the set of all elements $x_2 \in X$ such that $f(x_1) = f(x_2)$. But the provided solution does not seem to follow this definition, so I do not understand how it qualifies as an equivalence class?
I would greatly appreciate it if people could please take the time to clarify why the provided solution is correct and how it makes sense as an equivalence class, given the definition of equivalence class that I provided.
EDIT: If this solution is incorrect and/or incomplete, then what actually is the correct solution?
You are looking at the problem from the equivalence relation perspective. Given a relation $R$, it is an equivalence relation if it is reflexive, symmetric, and transitive. This is the definition and your solution is to prove that the given relation has those three features.
It seems the provided solution is taking a different perspective. One of the first things that one does with an equivalence relation is to use it to partition the set of definition of the relation into equivalence classes. The set, $X$ in this case, is partitioned into disjoint subsets whose union is the original set.
The missing piece seems to be that these two perspectives are the same. An equivalence relation defines a partition and a partition defines an equivalence relation (via $(x_1,x_2)\in R$ iff $x_1$ and $x_2$ are in the same subset in the partition).
Your solution used the first perspective, the provided solution uses the second perspective. The stumbling block seems to be recognizing that the two perspectives are equivalent.