Proving that a function with two variables is bijective In a study of cardinality and infinity, I have to prove that the following function is a bijection (first of all that it's injective). $v : \mathbb{N} \times \mathbb{N} \to \mathbb{N}$ defined by 
$$v(g,b)=1/2·b^2+1/2·b·(2·g-1)+1/2·g^2-3/2·g+1$$
Can anybody help me, please?
 A: First of all, try this out with a few examples.  
Note, that the proposition is only true if we are using a set of natural numbers without 0.
$v(1,1) = 1\\
v(1,2) = 2\\
v(2,1) = 3\\
v(1,3) = 4\\
v(2,2) = 5$
Mark the lattice points on the coordinate grid.  (1,1) maps to 1.  Now we move in diagonal lines filling in the grid.  
Let's play with the algebra:
$\frac 12 b^2 + \frac 12 b(2g - 1) + \frac 12 g^2 -\frac 32 g + 1\\
\frac 12 b^2 + bg + \frac 12 g^2 - \frac 12 b - \frac 32 g +1\\
\frac 12 (b + g)^2  - \frac 12 (b+g) - g +1\\
v(g,b)  = \frac 12 (b + g)(b+g-1)  - g + 1$
$\frac 12 (b + g)(b+g-1)$ is the sum of all natural numbers less than $b+g$
$v(g,b)$ is injective if $v(b,g) = v(x,y) \implies (b,g) =(x,y)$
$\frac 12 (b + g)(b+g-1)  - g + 1 = \frac 12 (x + y)(x+y-1)  - y + 1$
$\frac 12 (b + g)(b+g-1) - \frac 12 (x + y)(x+y-1)  = g-y$
if $b+g\ne x+y$
WLOG let $b+g > x+y$
$\frac 12 (b + g)(b+g-1) - \frac 12 (x + y)(x+y-1) \ge g > g-y$
And if $b+g = x+y$
then if follows that $g = y$ and $b=x$
The function is invective.
I will let you prove that it is subjective.
