When trying to prove the invertibility of an objects (say, the composition of two functions), do we always structure the proofs by showing, not necessarily in this order, (1) that the inverse of the function composed with the function is equal to the identity, and (2) that the function composed with the inverse is equal to the identity? This would show that the function is equal to its inverse, which is our goal in the proof, right?
I ask because I'm trying to remember how to prove such theorems when asked on exams, so if they always follow this structure/format, then I'll always know how to proceed, regardless of the specifics of the theorem I'm being asked to prove.
The following is an example of one such proof that follows this structure.
Theorem: If $f: X \to Y$ and $g: Y \to Z$ are invertible, then $g \circ f: X \to Z$ is also invertible, with inverse $f^{-1} \circ g^{-1}$.
Proof: Suppose that $f: X \to Y$ and $g: Y \to Z$ are invertible.
We first show that the inverse of the function composed with the function is equal to the identity.
$(f^{-1} \circ g^{-1}) \circ (g \circ f) = f^{-1} \circ ( g^{-1} \circ g ) \circ f$ (By associativity of composition.)
$= f^{-1} \circ (i_Y) \circ f$ (Since the composition of a function with its inverse is equal to the identity on the domain of the function.)
$= f^{-1} \circ f$ (Since the identity on $Y$ just maps from $Y$ back to $Y$.)
$= i_X$ (Since $f^{-1} \circ f$ just maps from $X$ back to $X$.)
And we now prove that the function composed with the inverse is equal to the identity.
$(g \circ f) \circ (f^{-1} \circ g^{-1}) = g \circ (f \circ f^{-1}) \circ g^{-1}$
$= g \circ (i_Y) \circ g^{-1}$
$= g \circ g^{-1}$
$= i_Z$
Therefore, $(g \circ f)^{-1} = f^{-1} \circ g^{-1}$.
$Q.E.D.$
Yes, the proof is correct and your description of the inverse function is correct and clear. Note that not every function is its own inverse.
If $gof$ and $fog$ are both identity functions, then $f$ and $g$ are inverses of each other.