# How to See if a Composite Function is One-To-One and Onto

So we have $$f$$ that is onto, and $$g$$ which is onto and one-to-one. Is $$f \circ g$$ onto and one-to-one?

My attempt at to solve this problem was to state the following scenarios and come to a conclusion. My proof method is below:

We know $$f$$ is onto so every element in its domain is mapped to one or more codomain making it onto.

$$g$$ is one-to-one and onto, so every element in $$g$$'s domain is mapped to a unique element in its codomain.

We know that $$g$$ goes to the domain of $$f$$. $$f$$ can map to the same element of the codomain; knowing that $$f$$ does this I can conclude that $$f \circ g$$ is not one-to-one and onto because of the fact that $$f$$ is onto.

Ex: Set $$A$$ contains $$a$$ and $$b$$, set $$B$$ contains $$c$$ and $$d$$, set $$C$$ contains $$e$$. $$g$$'s domain is $$A$$ codomain is $$B$$, and $$f$$'s domain is $$B$$ and codomain is $$C$$.

$$\text{}(f \circ g) = e \\ g(a) = c \\ f(g(a)) = e \\ \text{but} \\ g(b) =d \\ f(g(b)) = e \\ \therefore \text{(f \circ g) is not one-to-one a because the domain maps to multiple things in the codomain.}$$

My questions are: is this correct, and is this a valid way of doing this proof?

Take $$f:\mathbb{R}\to\mathbb{R}^{\geq 0}$$, $$x\mapsto x^{2}$$ and $$g:\mathbb{R}\to\mathbb{R}$$, $$x\mapsto x$$.
Then $$g$$ maps one-to-one and onto $$\mathbb{R}$$ and $$f$$ maps onto $$\mathbb{R^{\geq 0}}$$.
However, $$(f\circ g)=f:\mathbb{R}\to\mathbb{R^{\geq 0}}$$, $$x\mapsto x^{2}$$ is not one-to-one.