0

Lemma1: If $A=i+j$ then, $$\frac{(A-2)(A-1)}{2}+i\le \frac{A(A-1)}{2}.$$
Proof:
Since $j-1\ge0$,
$$A-1=i+j-1\ge i$$ and then $$-2(A-1)\le -2i$$ $$(A-2)(A-1)-A(A-1)\le -2i$$ $$(A-2)(A-1)+2i\le A(A-1)$$ $$\frac{(A-2)(A-1)}{2}+i\le \frac{A(A-1)}{2}.$$

Injective:
Suppose $f(i_1,j_1)=f(i_2,j_2)$. Let $A=i_1+j_1$ and $B=i_2+j_2$. Then by lemma1, $$\frac{(B-2)(B-1)}{2}+i_2=\frac{(A-2)(A-1)}{2}+i_1\le\frac{A(A-1)}{2}.$$
Now suppose $A\neq B$, without loss of generality take $A+1\le B$.
Then
$$\frac{A(A-1)}{2}=\frac{(A+1-1)(A+1-2)}{2}\le\frac{(B-1)(B-2)}{2}<\frac{(B-1)(B-2)}{2}+i_2,$$ a contradiction. Therefore $A=B$, so $$\frac{(A-2)(A-1)}{2}+i_1=\frac{(B-2)(B-1)}{2}+i_2=\frac{(A-2)(A-1)}{2}+i_2,$$ so $i_1=i_2$, and moreover $j_1=j_2$.

Bijective:
Take any positive integer $n$, we induct on it.
$Base$: $n=1$, let $i=j=1$, then $$\frac{(i+j-2)(i+j-1)}{2}+i=\frac{0}{2}+i=n.$$

$Step$: Suppose $n\ge1$ and $f(i,j)=n$ for some $i,j$ .
${\textit Case\; 1}:\;i>1,j=1$. Then $$f(i,j)=f(i,1)=\frac{i(i-1)}{2}+i.$$ and $$f(1,i+1)=\frac{i(i+1)}{2}+1=\frac{i(i-1+2)}{2}+1=\frac{i(i-1)}{2}+i+1=f(i,j)+1=n+1.$$
${\textit Case\;2}:\;i\ge1,j>1$. Then $$f(i+1,j-1)=\frac{(i+j-2)(i+j-1)}{2}+i+1=f(i,j)+1=n+1.$$

Is the proof valid? Are there any steps that could be improved or made shorter?

  • Keyword(s) "Cantor pairing function". – Jean Marie Aug 05 '23 at 21:42
  • @Edd i think there is a mistake in the surjection part. I say $f(i,j)=n$ for some $i,j$ and then let $j_2=j-1$, but $j$ could be equal to $1$, but the function is only defined on positive integers. Am I correct? – bobbyJames Aug 05 '23 at 21:48
  • @bobbyJames Sorry, I quickly overlooked the fact that some integer in your previous proof could be $0.$ But your modified proof of the induction now checks out. – Edd Aug 05 '23 at 22:14

0 Answers0