I need some hint to write this proof... I don't know where start or how to formalize it. The problem says
Let $\sim$ and $\overset{.}{\sim}$ be equivalence relations in $X$ and $Y$ respectively. Suppose that a function $f\in Y^X$ is such that $x\sim y$ implies $f(x)\overset{.}{\sim}f(y)$ for all $x,y\in X$. Prove that there is an unique function $f_*$ such that the diagram below is commutative
$$\require{AMScd} \begin{CD} X @>{f}>> Y\\ @V{p_X}VV @VV{p_Y}V \\ X/{\sim} @>{f_*}>> Y/{\overset{.}{\sim}} \end{CD}$$
where $p_X$ is defined as
$$p_X:X\to X/{\sim},\quad x\mapsto [x]$$
where $[x]=\{y\in X: x\sim y\}$ is the equivalence class of $x$, and $p_Y$ is defined similarly.
To the diagram be commutative we need that $p_Y\circ f =f_*\circ p_X$. For some $x_0\in X$ we have that $f(x_0)=y_0$ and $p_X(x_0)=[x_0]$. Then $p_Y(y_0)=[y_0]$ and should be $f_*([x_0])=[y_0]$.
It is "obvious" that $f_*$ is an unique set valued function that map some equivalence class of $X/{\sim}$ to other equivalence class of $Y/{\overset{.}{\sim}}$, but I don't know how to formalize this perception.
I can says that $f_*$ must be injective cause the relation $x\sim y\implies f(x)\overset{.}{\sim}f(y)$ is injective.
Can you help me please? Thank you in advance.
Define $$\begin{matrix}f_*:&X/{\sim}&\longrightarrow&Y/{\overset{.}\sim}\\&[x]&\longmapsto&[f(x)]\end{matrix}$$ We need to prove that $f_*$ is well-defined and the diagram above is commutative.
First, if $x\sim y$ then $f(x)\overset{.}{\sim}f(y)$, i.e., $[x]=[y]$, implies $[f(x)]=[f(y)]$. So if $[x]=[y]$ we have $f_*(x)=f_*(y)$.
Now, for all $x\in X$, $$f_*\circ p_X(x)=f_*([x])=[f(x)]=p_Y(f(x))=p_Y\circ f(x),$$ so $f_*\circ p_X=p_Y\circ f$.
For uniqueness, if $g:X/\sim\longrightarrow Y/\overset{.}\sim$ is such that $g\circ p_X=p_Y\circ f$, then, for all $[x]\in X/\sim$, we have $$g([x])=g\circ p_X(x)=p_Y\circ f(x)=f_*\circ p_X(x)=f_*([x]),$$ thus $g=f_*$.