Here is the problem:
Give an example of two functions $f :D→Y$ and $g:Y →W$ such that $D, Y$, and $W$ are finite sets and $g ◦ f$ is bijective, but neither $f$ nor $g$ is bijective.
I know that for bijection to take place they must be one-to-one and onto. In class we covered a lemma that stated "if $f$ and $g$ are one-to-one, so is $g ◦ f$, and if f and g are onto, so is $g ◦ f$." Is this relevant here?
I immagine the problem in this way. Say for example $D$ is the list of names of a class in math. The brother $b$ of a guy $d \in D$ join the class, and we have an injective map $f: D \to Y= D \cup \{b\}$, that is not bijective because $b$ is not taken. Now take $W$ to be the list of the surnames of the class, and map each name in $Y$ to the surname in $W$. This map $g: Y \to W$ is surjective, but not bujective, because the two brothers $b,d$ are mapped to the same surname.
On the other hand, the map $gf: D \to W$ is bijective, because to each name correspond one surname and viceversa.