Prove that $f$ is one-to-one iff $f \circ h = f \circ k$ implies $h = k$. Let $f: A \to B$ be a function. Prove that $f$ is one-to-one if and only if $f \circ h = f \circ k$ implies $h = k$, for every set $C$ and all choices of functions $h: C \to A$ and $k: C \to A$.
Here is my work:
Assume that $f$ is one-to-one and let $A = \{x_1, x_2\}$ for two arbitrary $x_1, x_2$.
So we have $f(x_1) = f(x_1)$ and $x_1 = x_2$. Assume $h$ and $k$ are one-to-one. (Is that okay assume that they are one-to-one?) And let $C = \{z_1, z_2\}$ so we have $h(z_1)=h(z_2) = x_1$ and $k(z_1) = k(z_2) = x_2$ since $h: C \to A$ and $k: C \to A$. 
If we substitute $h(z)$ and $k(z)$ into $x_1$ and $x_2$ respectively, we have $f(h(z)) = f(k(z))$.
It follows $f \circ h = f \circ k$ implies $h = k$.
Conversely, we assume that $f \circ h = f \circ k$. It follows $f(h(z_1))=f(k(z_2))$ follows $z_1 = z_2$.
Hence we can conclude that $h$ and $k$ are one-to-one.
Since we know $h: C \to A$ and $k: C \to A$, ($x_1$ and $x_2$ are elements of $A$) and $h(z_1) = x_1$ and $h(z_2) = x_2$. Since $h(z_1)=k(z_2)$ implies $x_1 = x_2$ and since these two elements are in $A$, $f$ is onto.
I know it is hard to read, but I really need your help to check my ambiguous proof. I know some part are wrong, so please let me know. Thank you very much.   
 A: In your 2nd sentence : " So we have f(x_1) = f(x_1) and x_1 = x_2" - what do you mean by this? Are you assuming $x_1 = x_2$? What you want to prove is this :
$$
x_1 \neq x_2 \Rightarrow f(x_1) \neq f(x_2)
$$
So start like this :
(a) Suppose $f$ is one-to-one, and choose two functions $h, k : C\to A$ such that
$$
f\circ h = f\circ k
$$
(You now want to show that $h = k$ - Your assumption that $h$ and $k$ are one-to-one is not needed.)
Suppose not - then there must exists $y \in C$ such that
$$
h(y) \neq k(y)
$$
Since $f$ is one-to-one,
$$
f(h(y)) \neq f(k(y))
$$
But $f(h(y)) = f\circ h(y) = f\circ k(y) = f(k(y))$! This is your contradiction.
For part (b) : Suppose
$$
f\circ h = f\circ k \Rightarrow h=k
$$
For any functions $h,k : C\to A$. Suppose $f$ is not one-to-one, then there exist $x_1, x_2 \in A$ such that
$$
x_1\neq x_2; f(x_1) = f(x_2)
$$
Define $h:\{1,2\} \to A$ by
$$
h(1) = x_1, h(2) = x_2
$$
and $k:\{1,2\} \to A$ by 
$$
k(1) = x_2, k(2) = x_1
$$
Now what do you see about $f\circ h$ and $f\circ k$?
