# Proving a multivariable function is injective?

I would like to prove that the map $$g:A\rightarrow \mathbb{Z}^+$$ defined by $$g(a,b)=\frac{1}{2}(a-1)a+b$$ is bijective, where $$A={\{(a,b):a,b\in\mathbb{Z}^+ and \space b\leq a\}}$$.

So far, I'm working on the injection part of my proof: Let $$a_1, b_1, a_2, b_2 \in \mathbb{Z}^+$$ where $$g(a_1, b_1)=g(a_2, b_2)$$. So far, I've simplied things down to $$a_1^2-a_1+2b_1=a_2^2-a_2+2b_2$$, but I'm not sure how I can prove that $$a_1=a_2$$ and $$b_1=b_2$$ from here. Could someone nudge me in the right direction?

• I'm not seeing the solution, but one suggestion might be to work on the surjection part. Once you figure out what the pre-image of a given value has to be, that might give you insight as to why there isn't another thing that'd work. And for the surjection, personally I'd start with playing around with concrete numbers, like 1-15 or so to see the pattern
– Alan
Apr 23, 2021 at 20:32

given $$c\in\Bbb Z^+$$, we look for $$a\in \Bbb Z^+$$, such that
$$\frac{a(a-1)}{2}< c\le \frac{a(a+1)}{2}$$ or $$f(a)\le c-1 if $$f(x)=\frac{x(x-1)}{2}$$ $$f^{-1}(x)=\frac{1+\sqrt{1+8x}}{2}$$
$$a=\lfloor \frac{1+\sqrt{8c-7}}{2}\rfloor$$