Naive Set Theory: Functions
Composite Functions
A function $f : A \rightarrow B$ takes elements from $A$ as "input" and produces elements from $B$ as "output". But can the output of one function be used as the input to another function? If the range of the first function matches the range of the second function, then the answer is yes! The combination of the two functions is called a composite function.
Given two functions $f : A \rightarrow B$ and $g : B \rightarrow C$, the composite $g \circ f$ of $f$ and $g$ is the function $g \circ f : A \rightarrow C$ where $(g \circ f)(a) = g(f(a))$. In set builder notation, $g \circ f : A \rightarrow C$ is the function whose rule is $\{ (a, c) : \text{There exists a } b \in B \text{ such that } f(a) = b \text{ and } c = g(f(a)) \}$.
Problems
Let $f : \mathbb{R} \rightarrow \mathbb{R}$ be a function defined by $f(x) = x^2 + 1$, and let $g : \mathbb{R} \rightarrow \mathbb{R}$ be a function defined by $g(x) = \sin(x) + 1$.

What is the rule for $g \circ f$?

What is the rule for $f \circ g$?

What is the rule for $f \circ f$?

What is the rule for $g \circ g$?

$(g \circ f)(x) = g(f(x)) = \sin(f(x)) + 1 = \sin\left(x^2+1\right) + 1$

$(f \circ g)(x) = f(g(x)) = g(x)^2 + 1 = \left(\sin(x)+1\right)^2 + 1 = \sin^2(x) + 2\sin(x) + 2$

$(f \circ f)(x) = f(f(x)) = f(x)^2 + 1 = \left(x^2+1\right)^2 + 1 = x^4 + 2x^2 + 2$

$(g \circ g)(x) = g(g(x)) = \sin(g(x)) + 1 = \sin\left(\sin(x)+1\right) + 1$

Show that the composition of an injection with an injection is itself an injection.
Because $g$ is injective, $g(f(a)) = g(f(a')) \implies f(a) = f(a')$. Because $f$ is injective, $f(a) = f(a') \implies a = a'$. Since $(g \circ f)(a) = (g \circ f)(a') \implies a = a'$, $g \circ f$ is injective.
Show that the composition of a surjection with a surjection is itself a surjection.
Let $f : A \rightarrow B$ and $g : B \rightarrow C$ be surjections. Then for each $c \in C$ there is at least one $b \in B$ such that $c = g(b)$. Likewise, there is at least one $a \in A$ such that $b = f(a)$. Thus for each $c \in C$ there is at least one $a \in A$ such that $c = g(f(a))$. Therefore $g \circ f$ is surjective.
Show that the composition of a bijection with a bijection is a bijection.
Let $f : A \rightarrow B$ and $g : B \rightarrow C$ be bijections. Then $f$ and $g$ are both injective and surjective. Therefore $g \circ f$ is both injective and surjective. Therefore $g \circ f$ is bijective.