Just want to ask if I've done this question correctly
Let $f: x \to y$ and $g: y \to z$ be functions. Suppose that the composite function $g \circ f$ is injective. Prove carefully that $f$ is injective.
Answer: $f(x) = y(x)$ for some $x,y \in X$, then $g(f(x)) = g(y(x))$, i.e. $g \circ f(x) = g \circ f(y)$, so since $g \circ f$ is injective we have $x=y$, so $f$ is injective.
Is this correct?
Your argument seems fine.
Just minor typo, suppose
$f(x)=f(y)$ for some $x,y \in X$.