Doubts in function mappings In an abstract algebra book, in section on mappings on sets, have following doubts,as specified in below two parts:
Part 1: It is stated in a given para.:
Let $ X, Y$  be sets, and let $ f:X->Y, g:Y->X $ be mappings, s.t. both $ f,g$  are inverse maps of each other. This means: $ fg = 1_Y, gf = 1_X$.  Such a $g$ if it exists, is denoted by $f^{-1}$.
It can be stated otherwise, that a map $ f: X-> Y$  has an inverse iff $f$ is 
one-to-one and onto, with proof as follows:
First prove the 'if' part: 
Assume that $f$ has an inverse $g$. Thus $g: Y -> X$ & $fg = 1_Y, gf = 1_X.$
(a) Need prove first that: $f$ is 1-1.
Proof: Assume $f(x_1)= f(x_2)$. Apply $g$ to both sides and use the fact that : $gf = 1_X$ to get: $x_1 = gf(x_1)= gf(x_2) = x_2$. <-----Issue (i)  (b) Now, need prove : $f$ is onto.Proof: Let $y$ be an arbitrary element of $Y$. Need find an element of $X$ that is mapped onto $y$. Let $x = g(y)$. Now using the fact that $fg = 1_Y$, get: $f(x) = f(g(y))= fg(y) = 1_Y(y)=y$.
Now, prove the 'only-if' part:
Assume that $f$ is 1-1 and onto. Define $g: Y -> X$ as follows: Let $y \in Y$, so there should exist a unique element $x \in X$, s.t. $f(x) = y$. Let $g(y) = x$. This rule makes $g$ a map since $x$ is unique. The fact that $g$ is inverse of $f$ follows directly from the defn. of $g$ and of inverse. Need write proof for the same.   <-----Issue(ii)

Description of issues:
Issue (i): Want to get my simple elaboration vetted :  In $1_Y, Y$ refers to the start element, i.e. $fg = Y->X->Y$. So, $x_1 = gf(x_1)= gf(x_2) = x_2$ means that map by $g$ of the same elements is the same still.
Issue (ii): The author wants a proof (it is an exercise question). I do not feel there can be proof to the "axiomatic definition" sort of thing given. 

Part 2: 
The book states that : Given the function g: Y -> X is the inverse of the function f: X -> Y if the two diagrams, as shown in parts (a), (b) in the below diagram commute.  The book states the definition of 'commutative diagram'(CD) as: Generally, a diagram of sets and maps is a CD, if following two paths through the diagram, from any of the sets to any of the other sets, give the same result (by function composition). And in a simple case as diagram (0), it means that there are three sets $X,Y,Z$ and maps $f: X-> Y, g: Y->Z, h: X->Z$, with the triangle being a "commutative diagram" or it "commutes" if $h = gf$.

It further asks :
(i) Is the diagrammatic definition of one function (mapping) being the inverse of the other different from the above (Part 1) statement for the same.
(ii) Can one draw with one diagram with four nodes and 5 arrows - which is commutative iff $g$ is the inverse of $f$.   Have drawn diagram (c) for that.
Note: In diagrams, 1_X means $1_X$, and so on for 1_Y.
 A: Issue 1. 
Saying $f(x_1)=f(x_2)$ says that  $f(x_1)$ and $f(x_2)$ represent the same element of $Y$. It does not have to be true that $x_1$ and $x_2$ are the same element of $X$. A simple example is, if $f(x)=x^2$, then $f(3)=f(-3)=9$. Note that this implies that $f$ is not invertible since then we would get $3 = g(f(3)) = g(f(-3)) = -3$.
Issue 2. "I do not see any need of proof in this axiomatic definition sort of thing.". This isn't a question. What is wrong with "this axiomatic definition sort of thing"?
in response to the comments
THEOREM. $ f: X \to Y$  has an inverse iff $f$ is one-to-one and onto.
Proof.

Suppose that $f$ has an inverse mapping $g:X \to Y$.

Since $g$ is an inverse map of $f$, then $gf(x_1) = 1_X(x_1) = x_1$ and $gf(x_2) = 1_X(x_2) = x_2$ for any 
$x_1, x_2 \in X$. It follows that, if $f(x_1) = f(x_2)$ for any $x_1, x_2 \in X$, then 
$x_1 = g(f(x_1)) = g(f(x_2)) = x_2$. Hence $f$ is one-to-one.
Let $y_1 \in Y$. Define $x_1 = g(y_1) \in X$. Then 
$f(x_1) = f(g(y_1)) = fg(y_1) = 1_Y(y_1) = y_1$. Hence $f$ is onto.
Hence, if $f$ has an inverse map, then $f$ is one-to-one and onto.

Suppose that $f$ is one-to-one and onto.

Define $g: Y \to X$ as follows.
Let $y \in Y$. Then there exists a unique element $x \in X$ for which
$f(x) = y$. Define $g(y) = x$. Does this really define a function 
$g:Y \to X?$ Yes. For every $y \in Y$ there exists a unique $x \in X$ such that g(y) = x$.
Let $y \in Y$ and let $x = g(y)$ as defined above. Then 
$fg(y) = f(g(y)) = f(x) = y = 1_Y(y)$ for every $y \in Y$. That is, 
$fg=1_Y$.
Also, $gf(x) = g(f(x)) = g(y) = x = 1_X(x)$ for every $x \in X$. That is 
$gf = 1_X$.
Hence, if $f$ is one-to-one and onto, then $f$ has an inverse map.
