Let us define the sequence as \(\{a_n\}_{n=1}^{\infty}\) , where \(a_n = \frac{p}{q}\) , \(p, q \in \mathbb{Z^+}\) , and
So, the initial few terms of the sequence are:
This formula provides a mapping from the set of ordered pairs of positive integers, \(\mathbb{Z}^+ \times \mathbb{Z}^+\), to the set of positive integers \(\mathbb{Z}^+\). By assigning each pair \((p,q)\) to a term \(a_n = p/q\), the sequence defines a surjection onto the set of positive rational numbers, \(\mathbb{Q}^+\). A key consequence of this is that the set \(\mathbb{Q}^+\) is countable.
It is important to note that, interestingly enough, in this series every rational number is repeated indefinitely. Thus \(1\) occurs as \(\frac{1}{1},\frac{2}{2},\frac{3}{3},\cdots\).We can, of course, avoid this by omitting every number which has already occurred in a simpler form, but then the problem of determining the precise position of \(p/q\) becomes more complicated.
We prove the formula in equation(1) as follows,
In the sequence described by equation(2), we observe that the numerators \(p\) and denominators \(q\) follow a specific pattern, which can be visualised in the following table:
To select a particular numerator p and its corresponding denominator q, follow these rules:
n-th element (e.g., n=8 ), we count through the sequence according to rule 1
until we reach nth position. For n=8 , we discover that q=2 and p=3(as shown in the animation above).Let \(a\) and \(b\) denote the row and column indices of the table, respectively. The tables follow the following formulas;
It is up to the readers to verify this. If you substitute \(a = p + q - 1\) and \(b = q\) into the equation \(b = \frac{a(1 - a)}{2} + n\), you will arrive at the required equation (1).
I will conclude this discussion, as this step is highly intuitive, and I encourage readers to engage with their own intuition in this matter.
The following table helps to visualize how we enumerate fractions diagonally, based on constant p + q values:
| p/q | 1 | 2 | 3 | 4 | 5 | 6 |
| 1 | 1/1 | 1/2 | 1/3 | 1/4 | 1/5 | 1/6 |
| 2 | 2/1 | 2/2 | 2/3 | 2/4 | 2/5 | 2/6 |
| 3 | 3/1 | 3/2 | 3/3 | 3/4 | 3/5 | 3/6 |
| 4 | 4/1 | 4/2 | 4/3 | 4/4 | 4/5 | 4/6 |
| 5 | 5/1 | 5/2 | 5/3 | 5/4 | 5/5 | 5/6 |
| 6 | 6/1 | 6/2 | 6/3 | 6/4 | 6/5 | 6/6 |
We move anti-diagonally, where the sum p + q remains constant on each diagonal:
1/12/1, 1/23/1, 2/2, 1/34/1, 3/2, 2/3, 1/4To find the nth term of the sequence, use:
Where:
x is the diagonal number (total number of steps to reach the diagonal)y helps extract the denominator qx = p + q - 1)Steps to find the nth term from the table:
x using the ceiling formula for the diagonal indexp = x - q + 1aₙ = p/qThe formula in Equation(1) works by traversing the anti-diagonals of an infinite grid of fractions. The sequence is constructed by grouping terms where the sum of the numerator and denominator, \(p+q\), is constant.
The term \(\frac{(p+q-2)(p+q-1)}{2}\) is simply the formula for the \((p+q-2)\)-th triangular number, which counts the total number of elements in all the preceding groups. The term `\(+q\)` then specifies the position within the current group. This visual method suggests that every pair \((p,q)\) will eventually be reached. We will now prove this formally.
The proof consists of two parts. First, we show that every positive rational number appears at least once. Second, we extend this to show that every rational number appears infinitely many times.
Claim: For any positive rational number \( \frac{x}{y} \), where \( x, y \in \mathbb{Z}^+ \), there exists a positive integer \( n \) such that \( a_n = \frac{x}{y} \).
Proof by Construction:
Since we can find a valid index \( n \) for any arbitrary rational \( \frac{x}{y} \), we have proven that every positive rational number appears at least once.
Claim: Any positive rational number appears at an infinite number of distinct positions in the sequence.
Proof:
Since we can find a distinct position \( n_k \) for every positive integer \( k \), we have proven that every positive rational number appears infinitely many times in the sequence.