Show that $g$ is injective if and only if for any set $A$ and pair of maps $f_1: A \rightarrow X$ and $f_2: A \rightarrow X,$ we have $g\circ f_1=g \circ f_2$ implies $f_1 = f_2.$
I can do the forward direction:
Proof: $(\Rightarrow)$ Assume $g$ is injective. Then, for all $x_1,x_2 \in X$, $g(x_1) = g(x_2)$. Let $f_1, f_2$ be maps $f_1: A \rightarrow X$ and $f_2: A \rightarrow X,$ for some $A$.
Assume that $g\circ f_1=g \circ f_2$. Then, $(g\circ f_1)(a)=(g \circ f_2)(a)$, for all $a \in A$.
So, $g\circ (f_1(a))=g \circ (f_2(a))$. Since $g$ is injective, $f_1 (a) = f_2 (a)$ for all $a \in A$. Then, $f_1 = f_2$.
I have no idea how to do the other direction, can someone give me a hint?