$\Bbb Z_+\times \Bbb Z_+$ is countable This question is from Munkres' Topology:

Munkres proves $\Bbb Z_+\times \Bbb Z_+$ is countably infinite thus:
First define $f:\Bbb Z_+\times \Bbb Z_+\rightarrow A$, where $A$ is the subset of $\Bbb Z_+\times \Bbb Z_+$ consisting of pairs of $(x,y)$ for which $y\le x$, by the equation $$f(x,y)=(x+y-1,y).$$ Then we construct a function $g: A\rightarrow \Bbb Z_+$ by the formula $$g(x,y)=\frac12 (x-1)x+y.$$ $g \circ f$ is bijection since $f$ and $g$ bijection.

I can't understand how did we guess function $g$. Also, help me visualize it!


Here is a picture to go with my comment
