Understanding Theorems on Composition of functions Consider below two theorems about Injective and Surjective mappings

Theorem 1: If $f: A \rightarrow B$ and $g: B \rightarrow C$ be two mappings such that $g \,\circ\,f: A \rightarrow C$ is injective then $f$ is injective.
Theorem 2: If $f: A \rightarrow B$ and $g: B \rightarrow C$ be two mappings such that $g \,\circ\,f: A \rightarrow C$ is surjective then $g$ is surjective.



*

*Theorem 1 signifies that in order to $g \,\circ\,f$ to be injective it is not necessary that $g$ is injective. But as you can see from the below figure $g \,\circ\,f$ is not injective, If $g$ is not injective.


*Theorem 2 signifies that in order to $g \,\circ\,f$ to be surjective it is not necessary that $f$ is surjective. But as you can see from the below figure $g \,\circ\,f$ is not surjective, If $f$ is not surjective.

I'm not getting these theorems. Can anybody explain, What above theorems are trying to say.
 A: For theorem 1, consider $A=\{1,2\}, B=\{3,4,5\}, C= \{6,7,8\}$, and now


*

*Let $f = \{(1,3),(2,5)\}$ which is injective

*Let $g=\{(3,6),(4,6),(5,7)\}$ which is not injective

*Then $g\circ f = \{(1,6),(2,7)\}$ and this is injective.


Thus $g\circ f$ can be injective when $g$ is not.
For distinctness to be preserved on mapping $A\to C$ the mapping of $A\to B$ must preserve distinctness.   However, the mapping from $B\to C$ need not preserve distinctness except among the subset of elements that is the image $f(A)$.   (That is, our $g$ need not be injective if $f$ is not surjective). 
Theorem 1 is that if we know that $g\circ f$ is injective, that guarantees that $f$ is injective.   Other properties of $f$ and $g$ are not guaranteed by that knowledge.

Similarly for theorem 2. Consider $A=\{1,2\}, B=\{3,4,5,6\}, C= \{7,8,9\}$ 


*

*Let $f = \{(1,3),(1,4),(2,5)\}$ which is not surjective

*Let $g=\{(3,7),(4,8),(5,9),(6,9)\}$ which is surjective

*Then $g\circ f = \{(1,7),(1,8),(2,9)\}$ and this is surjective.


So it is possible for $g\circ f$ to be surjective when $f$ is not.
Any $g\circ f$ is surjective if every element in $C$ is mapped to by an element in $A$.   This requires that every element is $C$ is mapped to by some elements in $B$ of which at least one is mapped to by an element in $A$; it does not require every element in $B$ to be mapped to by an element in $A$.
So knowing that $f\circ g$ is surjective only guarantees that $g$ is surjective. 
A: Consider two independent  operations: (i) putting things in a box  (This is $f$) and (ii) delivering   whole boxes to people (this is $g$).  We can compose these operations: that is carry out (ii) after (i) (i.e. $g\circ f$.) If you were told two different things always got delivered to two different persons. (i.e. $g\circ f$ is injective) then it follows that two items were never put into the same box in the first place.
You can figure out a similar scenario for surjectivity. 
A: For theorem 2. You cannot consider oaths not starting in $A$ since $A$ is the domain of your composite function.
A: If $g \circ f$ is injective, this means that different $a_1, a_2$ in $A$ go to different values $(g \circ f)(a_1)$ and $(g \circ f)(a_2)$ in $C$. These values are by definition equal to $g(f(a_1))$ and $g(f(a_2))$. This means that $f$ must already map $a_1$ and $a_2$ to different values in $B$ (otherwise their common $g$ value ($g(f(a_1)) = g(f(a_2))$) would be the same which it is not). So $f$ must already map different $a_1,a_2$ to different values, or $f$ is injective. We can only conclude for $g$ that for points in $f[A]$ (the actual values reached by $f$) $g$ is injective, but we cannot say anything about points outside of $f[A]$.
If $g \circ f$ is surjective, this means that every $c \in C$ is reached by $g \circ f$, so there is some $a \in A$ with $c = (g \circ f)(a) = g(f(a))$. But this means that $g$ reaches all $c$ as well, as we have found a point $f(a) \in B$ that maps to it. So $g$ is even surjective when restricted to points of $f[A]$ alone.
As to the pictures: the first shows that $g$ need not be injective (while $f$ is) while $g \circ f$ is injective, and the second shows that $f$ need not be surjective (while $g$ is) and $g \circ f$ is surjective. So these pictures show that beyond $f$ injective for 1 and $g$ surjective for 2, you cannot say that the other function is also injective (in 1) or surjective (in 2).
