Equivalence relation proof

Hello again, I'm back with one more proof question, this time concerning equivalence relations. I have an okay time conceptualizing what is supposed to be going on in the proof, but actually laying everything out in a manner that makes sense / is correct is tough for me.

I feel fairly confident with showing that $\displaystyle \sim$ is reflexive, but in my other steps, equating things to $\displaystyle y$ like that just made it seem to easy, as if I perhaps missed something vital.

Anyway, here's what I've done so far for this proof:

**Theorem**: Let $\displaystyle f : X \to Y$ be a function. Define a relation on $\displaystyle X$ via $\displaystyle x_1 \sim x_2$ iff $\displaystyle f(x_1) = f(x_2)$. Then $\displaystyle \sim$ is an equivalence relation.

**Proof**: Let $\displaystyle f : X \to Y$ be a function. Define a relation on $\displaystyle X$ via $\displaystyle x_1 \sim x_2$ iff $\displaystyle f(x_1) = f(x_2)$.

Reflexive: Let $\displaystyle x \in X$. We see that $\displaystyle f(x)=f(x)$. So $\displaystyle x \sim x$.

Symmetric: Let $\displaystyle x_1, x_2 \in X$ where $\displaystyle f(x_1) = y$ and $\displaystyle f(x_2) = y$ for some $\displaystyle y \in Y$. We see that $\displaystyle f(x_1) = y = f(x_2)$ and similarly $\displaystyle f(x_2) = y = f(x_1)$. So $\displaystyle x_1 \sim x_2$.

Transitive: Let $\displaystyle x_1, x_2, x_3 \in X$ where $\displaystyle f(x_1) = y$, $\displaystyle f(x_2) = y$, and $\displaystyle f(x_3) = y$ for some $\displaystyle y \in Y$. We see that $\displaystyle f(x_1) = y = f(x_2)$. We also see that $\displaystyle f(x_2) = y = f(x_3)$. Transitively, we see that $\displaystyle f(x_1) = y = f(x_3)$. So $\displaystyle x_1 \sim x_3$.

Therfore, by definition, $\displaystyle \sim$ is an equivalence relation.