How to prove $(f \circ\ g) ^{-1} = g^{-1} \circ\ f^{-1}$? (inverse of composition)

You put your socks first and then your shoes but you take off your shoes before taking off your socks.


Use the definition of an inverse and associativity of composition to show that the right hand side is the inverse of $(f \circ g)$.


$$\begin{align} & \text{id} \\ =& f \circ f^\circ \\ =& f \circ \text{id} \circ f^\circ \\ =& f \circ (g \circ g^\circ) \circ f^\circ \\ =& f \circ g \circ g^\circ \circ f^\circ \\ =& (f \circ g) \circ (g^\circ \circ f^\circ) \end{align}$$

Therefore $(f \circ g)^\circ = g^\circ \circ f^\circ$.