Solution (source code)

= Solution

The homomorphism law and $gg^{-1}=g^{-1}g=e$ give
$$
D(g)D(g^{-1})=D(e)=I,\qquad D(g^{-1})D(g)=I.
$$
Thus $D(g^{-1})$ is both a left and right inverse of $D(g)$, proving
$$
\boxed{D(g^{-1})=[D(g)]^{-1}.}
$$
If only multiplicativity is initially stated, $D(e)^2=D(e)$ together with invertibility of representation matrices first implies $D(e)=I$. This explains why a <group representation> takes values in the <general linear group> rather than arbitrary square matrices.