Proof of the existence of a well-defined function $\bar{f}$(2) Here is the question I am trying to solve (it is also mentioned in the answer of this link):
Proof of the existence of a well-defined function $\bar{f}$.
Let $X$ and $Y$ two sets and let $f:X\to Y$.
Define for $x_1,x_2\in X$ a relation in $X$ as $x_1\sim x_2$ if $f(x_1)=f(x_2)$.

*

*Prove that this defines an equivalence relation on $X$.

Now you can talk about the quotient $X/\sim \quad = \{[x]:x \in X\}$, the set of the classes of equivalence.
Define $\bar{f}(x):X/\sim \quad \to Y$ as $\bar{f}([x]) = f(x)$.
Since the definition uses an element of the class this could be ill-defined.


*Prove that this is well defined.

Now define $\pi:X \to X/\sim$ as $\pi(x) = [x]$.
Then


*$f = \bar{f}\circ\pi$


*$\bar{f}$ is injective


*$\pi$ is surjective
For the proof of 1) and 5) I have no problem in them.
For the proof of 2)
Assume that $[x_{1}] = [x_{2}]$ then $[f(x_{1})] = [f(x_{2})]$ but then what I do not know how to complete. Could anyone help me in that, please?
For the proof of 3)
I do not know how to do it. Could anyone help me in that, please?
For the proof of 4)
I know that it should be the reverse of 2)

When you try to prove 2), you put square brackets around $f(x_1), f(x_2)$.  These are incorrect (in fact do not mean anything as there is no equivalence relation defined on $Y$ at this point).  It should be:

For the proof of 2)
Assume that $[x_{1}] = [x_{2}]$ then $f(x_{1}) = f(x_{2})$

From this it is clear that $\bar{f}([x])= f(x)$ is well defined e.g. it does not matter which representative of the class $[x]$ you select.
For part 3):
$$\bar{f}\pi(x)=\bar{f}([x])=f(x),$$
by definition of the functions $\bar{f}$ and $\pi$.
For part 4): You are right it is the reverse of 2):
If $\bar{f}([x_1])=\bar{f}([x_2])$ then $f(x_1)=f(x_2)$ so $[x_1]=[x_2]$, by the definition of the equivalence relation.
