cardinality of cartesian product of the infinite set of natural numbers One of the problems in my discrete math course states that we need to prove that $\mathcal{N}\times\mathcal{N}$ is countable specifically when there's a function $f:\mathcal{N}\times\mathcal{N}\to\mathcal{N}$ defined as follows:
$$f(a,b)=\frac{1}{2}(a+b+1)(a+b)+a$$
where $a,b \in \mathcal{N}$. The solution uses the function definition in order to prove that the function is bijective as shown below:
$$f(a,b+1)=\frac{1}{2}(a+b+1+1)(a+b+1)+a=$$
$$=\frac{1}{2}(a+b+1)(a+b)+a+\frac{1}{2}(a+b+1)\cdot2$$
How is the transition achieved? I tried all kinds of arithmetics and couldn't arrive to the expression after the equal sign.

$\frac{1}{2}(a+b+1+1)(a+b+1)+a=\frac{a^2+ab+a+ba+b^2+b+a+b+1+a+b+1}{2}+a=\frac{a^2+b^2+2ab+3a+3b+2}{2}+a=\frac{a^2+b^2+2ab+5a+3b+2}{2}$
$\frac{1}{2}(a+b+1)(a+b)+a+\frac{1}{2}(a+b+1)\cdot 2=\frac{a^2+ab+ba+b^2+a+b}{2}+a+\frac{2a+2b+2}{1}=\frac{a^2+b^2+2ab+5a+3b+2}{2}$
