<s>[INST] Prove that $\frac{1}{2} (x-1) x + y$ is a bijection. (on p.45 Munkres Topology 2nd Edition) I am reading "Topology 2nd Edition" by James R. Munkres.
On p.45, Munkres leaves it to the readers to show that $g$ is bijection:

Show that $g(x, y) = \frac{1}{2} (x-1) x + y$ is a bijection from $\{(x, y) \in \mathbb{Z}_{+} \times \mathbb{Z}_{+} \mid y \leq x\}$ to $\mathbb{Z}_{+}$.

I proved the above fact, but I am not sure my proof is right or not.
And if my proof is right, please give me a better proof.
My proof:

$g$ is injective:
Let $(x, y), (x^{'}, y^{'}) \in \mathbb{Z}_{+} \times \mathbb{Z}_{+}$ and $y \leq x$ and $y^{'} \leq x^{'}$.
Let $(x, y) \neq (x^{'}, y^{'})$.
If $x \neq x^{'}$, then $x < x^{'}$ or $x > x^{'}$. Without loss of generality, we can assume $x < x^{'}$.
Then, $x+1 \leq x^{'}$, because if $x+1 > x^{'}$, then $0 < x^{'} - x < 1$ and $x^{'} - x \in \mathbb{Z}_{+}$.
But there is no element $x \in \mathbb{Z}_{+}$ such that $0 < x < 1$.
$$\frac{1}{2}(x-1)x+y \leq \frac{1}{2}(x-1)x+x =\frac{1}{2}x(x+1)\leq \frac{1}{2} (x^{'}-1)x^{'}<\frac{1}{2} (x^{'}-1)x^{'}+y^{'}.$$
If $x = x^{'}$ and $y \neq y^{'}$, then $y < y^{'}$ or $y > y^{'}$. Without loss of generality, we can assume $y < y^{'}$.
$\frac{1}{2}(x-1)x+y = \frac{1}{2}(x^{'}-1)x^{'}+y <  \frac{1}{2}(x^{'}-1)x^{'}+y^{'}$.
So, $g$ is injective.


$g$ is surjective:
We prove by induction.
$1 = \frac{1}{2} (1 - 1) 1 + 1$ and $1 \leq 1$.
Assume that $n = \frac{1}{2} (x - 1) x + y$ and $y \leq x$.
If $y < x$, then $n+1 = \frac{1}{2} (x - 1) x + (y+1)$ and $y+1 \leq x$.
If $y = x$, then $n+1 = \frac{1}{2} (x - 1) x + y+1 = \frac{1}{2} (x - 1) x + x+1 = \frac{1}{2} x (x + 1) + 1$ and $1 < x+1$.
So, $g$ is surjective.

 [/INST] Your proofs are fine.
Here is a quicker proof of injectivity. Suppose $T_{x-1}+y=T_{x'-1}+y'$ for $y\le x$ and $y'\le x'$ where $T_x=x(x+1)/2$ is the $x$th triangular number. Without loss of generality let $x<x'$ and thus $$T_{x-1}+y\ge T_x+1\implies y\ge(T_x-T_{x-1})+1=x+1$$ which is a contradiction. Hence $x=x'$ from which it follows that $y=y'$.
A quicker proof of surjectivity is that any positive integer can be written as a triangular number $T_{x-1}$ plus the remainder which is at most $x$, since $T_{x-1}+x=T_x$.
</s>