Let $A=\{1,2,3,4\} ; B=\{3,5,7,9\} ; C=\{7,23,47,79\}$ and $f: A \rightarrow B, g: B \rightarrow C$ be defined as $f(x)=2 x+1$ and $g(x)=x^{2}-2$. Express $(g \circ f)^{-1}$ and $f^{-1} \circ g^{-1}$ as the sets of
ordered pairs and verify that $(g \circ f)^{-1}=f^{-1} o g^{-1}$.
$f(x)=2 x+1$
$\Rightarrow f=\{(1,2(1)+1),(2,2(2)+1),(3,2(3)+1),(4,2(4)+1)\}=\{(1,3),(2,5),(3,7),(4,9)\}$
$g(x)=x^{2}-2$
$\Rightarrow g=\left\{\left(3,3^{2}-2\right),\left(5,5^{2}-2\right),\left(7,7^{2}-2\right),\left(9,9^{2}-2\right)\right\}=\{(3,7),(5,23),(7,47),(9,79)\}$
Clearly $f$ and $g$ are bijections and, hence, $f^{-1}: B \rightarrow A$ and $g^{-1}: C \rightarrow B$ exist.
So, $f^{-1}=\{(3,1),(5,2),(7,3),(9,4)\}$
and $g^{-1}=\{(7,3),(23,5),(47,7),(79,9)\}$
Now, $\left(f^{-1} \circ g^{-1}\right): C \rightarrow A$
$f^{-1} o g^{-1}=\{(7,1),(23,2),(47,3),(79,4)\}$$\ldots(1)$
Also, $f: A \rightarrow B$ and $g: B \rightarrow C$,
$\Rightarrow g o f: A \rightarrow C,(g o f)^{-1}: C \rightarrow A$
So, $f^{-1} o g^{-1}$ and $(g o f)^{-1}$ have same domains.
$(g o f)(x)=g(f(x))=g(2 x+1)=(2 x+1)^{2}-2$
$\Rightarrow(g o f)(x)=4 x^{2}+4 x+1-2$
$\Rightarrow(g o f)(x)=4 x^{2}+4 x-1$
Then, $(g o f)(1)=g(f(1))=4+4-1=7$,
$(g o f)(2)=g(f(2))=4+4-1=23$
$(g o f)(3)=g(f(3))=4+4-1=47$ and
$(g o f)(4)=g(f(4))=4+4-1=79$
So, $g o f=\{(1,7),(2,23),(3,47),(4,79)\}$
From $(1)$ and $(2)$, we get:
$(g o f)^{-1}=f^{-1} o g^{-1}$